+ Start a Discussion

Required sample code to create the new record in account based on the record type using the rest api

I was new i writting the rest api . i have gone through google and find some useful links in writing the rest api , but i was stuck to create the new record based on the record type in account .(eg : i have two recordtypes buyer and seller . i need create record in account object under buyer record ).

can some can help. It will be more great help to me
Tony TannousTony Tannous

Go to developer console 

and run this soql 
select id,name

from recordtype

Once you have the resultat , select the id of the recordtype you want ,

and while creating the account using the restapi,set the field name recordtypeId with the id of the recordype .

Good Luck

Andy BoettcherAndy Boettcher
RecordTypeId is a field on your object - use Tony's comment to get your Ids, and then just enter your value in your object just as you would a text value in a text field.