function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sideburnsideburn 

create a contact with link to account id

Hi. I want to add an account to my contact. I created an account and got the account's owner ID and then i try to insert that ID into my contact but no luck. This is what I am doing:

$FIELDS=array('type'=>'contact','FirstName'=>'newtest','LastName'=>'test', 'AccountId'=>"00530000000p0A8AAI");
$result = $client->create($FIELDS);

if I do this:

$FIELDS=array('type'=>'contact','FirstName'=>'newtest','LastName'=>'test');

the contact does get created..so it has something to do with trying to add the account to the contact.

I also tried $client->insert

any help would be great, thanks.
SuperfellSuperfell
00530000000p0A8AAI is not an accountId, its a UserId.
sideburnsideburn
ahhh. I was getting the OwnerID this:

$query_str = "select 'OwnerId' from 'account' where Name = 'accountTest'";

i changed it to Id and now i get the correct number and it works.. thanks!

Message Edited by sideburn on 02-23-2006 12:45 PM

SuperfellSuperfell
OwnerId is the userId that owns the account, it should be

select id from account where Name='accountTest'

of course, if there's multiple accounts with that name, you have a bit of a problem.
sideburnsideburn
got it. thanks