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
Gelu G.Gelu G. 

Rest API create account and return more fields

Hi,
We have person accounts enabled for our Salesforce instance.  I am using the Rest API to create an account record.  When an an account is created, there is formula field that gets calculated automatically to ge the long person contact id.  Is there a way to specifiy this attribute in the response?  I don't want to have to make a second call to get the long person contact id.
v varaprasadv varaprasad
Hi Gelu,

Use return type id in the method :

insert act;
account acc = [select id,contactid from account where id =: acc.id];
return acc.contactid;



Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.


Salesforce Freelance Consultant/Developer/Administrator/Trainer
@For Salesforce Project Support: varaprasad4sfdc@gmail.com

Salesforce latest interview questions and training videos :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1

 
Gelu G.Gelu G.
Hi Varaprasad,
Aren't you still making two calls; one for insert and another one that has the select statement?  Our website is built on Node.JS and we are using the JSforce library for interacting with SF.  The create method doesn't really have any other option that will allow us to specify extra fields we need.  Any thoughts?