Receiving "Failed, One and only one of the addresses can be primary address."

Home Forums General Issues Receiving "Failed, One and only one of the addresses can be primary address."

This topic contains 1 reply, has 2 voices, and was last updated by  Colin Pizarek 3 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #915

    Poe Stewart
    Participant

    When using the “account/createIndividualAccount” call to the API I am receiving this message “One and only one of the addresses can be primary address.” this is happening even when I have specified ‘individualAccount.primaryContact.addresses.address.isPrimaryAddress’=>true,

    Here is the code I am using minus identifiable details:

    <?php
    	// Allow the display of error messages
    	ini_set('display_errors', 'On');
    	error_reporting(E_ALL);
    	require_once('neon.php');
    	$neon = new Neon();		
    	$keys = array(
    		
    		
    		'orgId'=>'ORGID', 
    	    'apiKey'=>'APIKEY'
    
    	); 
    	$status = $neon->login($keys);
        
    ?>
    <html>
    	<header>
    		
    	</header>
    <body>
    	<h3>Test to include address info with NeonCRM Account</h1>
    	
    <?php
    	echo '<pre>';
    	$fName = 'Henry';
    	$lName = 'Williams';
    	$uName = 'HenryWilliams';
    	$pWord = 'Action9876';
    	// Create an Individual Account
    	$params2['method'] = 'account/createIndividualAccount';
    	$params2['parameters'] = array(
    	
    	'individualAccount.primaryContact.firstName'=>$fName,
    	'individualAccount.primaryContact.lastName'=>$lName,
    	'individualAccount.primaryContact.phone1'=>5035551212,
    	'individualAccount.primaryContact.phone1Type'=>'Mobile',
    	'individualAccount.primaryContact.addresses.address.isPrimaryAddress'=>false,
    	'individualAccount.primaryContact.addresses.address.addressType.id'=>1,
    	'individualAccount.primaryContact.addresses.address.addressLine1'=>'123 main street',
    	'individualAccount.primaryContact.addresses.address.addressLine2'=>'Appartment 303',
    	'individualAccount.primaryContact.addresses.address.city'=>'Beaverton',
    	'individualAccount.primaryContact.addresses.address.state.name'=>'OREGON',
    	'individualAccount.primaryContact.deceased'=> false,
    	'individualAccount.primaryContact.dob'=>'1998-06-25',
    	'individualAccount.noSolicitation'=>true,
    	'individualAccount.url'=>'http://www.yahoo.com',
    	'individualAccount.login.username'=>$uName,
    	'individualAccount.login.password'=>$pWord,
    	'sendAcknowledgeEmail'=>true ,
    								   
    								   );
    	var_dump($params2);
    	$resp2 = $neon->go($params2);
    	if ($resp2['operationResult'] == 'FAIL') {
    		$str =  'Failed ' . $resp2['errors']['error'][0]['errorMessage'];
    		$accountID = -99;
    	}
    	else {
    		$str = 'Created account ' . $accountID;
    		$accountID = $resp2['accountId'];
    	}
    
    ?>
    	<h3> Welcome <?php echo $fName . ' ' . $lName ?></h3>
    	<h3> <?php echo $str ?></h3>
    	
    <?php 
        //
    	// Logout of NeonCRM
    	//
    	$params['method'] = 'common/logout';
    	$resp = $neon->go($params);
    	$stat = $resp['operationResult'];
    	echo "From logout:  ";
    	var_dump($stat);
    	echo "</pre>";
    	?>
    </body>
    </html>
    #916

    Colin Pizarek
    Keymaster

    When you’re using the Neon PHP library, you’ll need to send your boolean values as text strings instead of true booleans.

    Your parameter:

    'individualAccount.primaryContact.addresses.address.isPrimaryAddress'=>true,

    …actually needs to be sent as:

    'individualAccount.primaryContact.addresses.address.isPrimaryAddress'=>'true',
    • This reply was modified 3 years, 6 months ago by  Colin Pizarek.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.