1

I have multiple record types on the Lead object. I am trying to query and get the correct converted lead status, but since I have multiple converted statuses due to using lead processes I am having trouble getting the correct value.

This query returns the first record it finds, which isn't the one I want. How can I get the correct MasterLabel based on the Lead Record Type?

SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1
  • Cant you filter by the label of the specific converted status you'd like to grab? – Nicholas Zozaya Mar 2 '19 at 6:56
2

There is no relationship between LeadStatus and record type, so you will have maintain your own values map using Custom Metadata or Custom Settings. For example, you could create a Custom Metadata object where one field is the record type name and another field is the converted status value, then pull these values into a Map when you need to do your processing.

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.