+ Start a Discussion

Creating Person Account from API



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?



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


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


What am I missing?


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'



        $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 />";






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


Any Ideas? 


Thanks for the help.