0

I have a service that's creating Leads on a user's behalf using the Salesforce REST API calls. I have a new user whose account is having trouble because I guess I need to set a RecordType on Lead creation.

This user (and all of my users, in fact) signed up for this service but they weren't prompted to select a RecordType, so I have no way of knowing what they might want to use when creating the Lead.

What is the correct way/best practice to find the RecordType for this situation? It seems that the best I can do is guess at what he might want as the RecordType but that's not an ideal solution because the Lead may have the wrong RecordType and there doesn't seem to be a way to change it in the Salesforce.com interface.

1 Answer 1

0

You can rely on some fields that user inputs to set the record type of the lead. A dropdown list for instance. You can then query record type object in Salesforce to get the id of the record type you're after

select id , name from recordtype where sobjecttype ='lead'

You can then assign the id you got to the lead.

4
  • Let's say I don't provide an option for the user to select from that list. What are the best practices for this situation? Jul 28, 2015 at 4:35
  • @user3082031 The default will be whatever their profile says is the default. See Setup > Manage Users > Profiles > "Profile Name" > Record Types. Users can choose to automatically select the default record type under My Personal Information > Record Type Selection.
    – sfdcfox
    Jul 28, 2015 at 4:44
  • Do users have to set a default? Jul 28, 2015 at 16:08
  • Salesforce sets a default record type by default an admin can change. Aug 10, 2015 at 23:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.