Salesforce api list all possible contact roles

opportunitycontactrole

I have an app that my users can create their own opportunity contacts. I need to present a list of possible contact roles. What can i call to get that list? The OpportunityContactRole requires I provide a oppId. I want the overall list of possible options.

I found this:

/ui-api/object-info/{objectApiName}/picklist-values/{recordTypeId}/{fieldApiName}

I assume:

{objectApiName} = OpportunityContactRole
what does {recordTypeId} and {fieldApiName} equal?

Best Answer

The recordTypeId property is the Record Type you want to describe; Record Types allow you to create different page layouts with different picklist options for the same picklist fields. The fieldApiName is the field you want to describe, such as Role or My_Custom_Field__c.

If you want all values, use the recordTypeId of 012000000000000AAA, this is known as the Master Record Type. If you don't want to get one specific field, you can get all fields on an object by omitting the fieldApiName. So, for OpportunityContactRole records, you could can get all fields with:

/services/data/v53.0/ui-api/object-info/OpportunityContactRole/picklist-values/012000000000000AAA

Or just one field with:

/services/data/v53.0/ui-api/object-info/OpportunityContactRole/picklist-values/012000000000000AAA/Role
Related Topic