+ Start a Discussion
CutMyCostsCutMyCosts 

Creating Person Account from API

Hello,

 

I'm using the PHP API to create new accounts, right now they are being created as 'Business Accounts'. What can I set so they are created as Person Accounts?

 

I tried setting:

 

 

$records[0]->type = 'Person_Account';

 But that did not work.

 

Any Ideas?

 

SuperfellSuperfell

You need to set the RecordTypeId field to a person account record type.

CutMyCostsCutMyCosts

I've tried setting 'RecordTypeId' to 'Person Account', 'Person_Account', 'PersonAccount'. None work. I've tried the same with 'RecordType'

 

What am I missing?

SuperfellSuperfell

It needs setting to the Id (the 18 character string) of the relevant record type record. You can run this query to see your recordType record (or look in the UI) 

select id, name from recordType where sobjecttype='account'

CutMyCostsCutMyCosts

 

        $result =$sForceCon->query("Select Id, Name from recordType where sobjecttype='account'");

        for($i = 0; $i < count($result->records); $i++)
        {
                echo $i . ": " . $result->records[$i]->fields->Name . " ID: " . $result->records[$i]->fields->Id . "<br />";
        }

 

 

Returns:

 

 

0: Person Account ID: 
1: Business Account ID: 

 

Any Ideas? 

 

Thanks for the help.