Skip to main content
Matthew Linford perguntou em #Apex
Is there a way to specify which record type of an object you want to target when using getDescribe? 

This might not be possible or even useful. Does anyone know if the information that getDescribe gives for an object would be different for various record types?

Specifically I'm using the getDescribe to focus on the fields on the object and then use getDescribes on those fields. I figured that the fields might be different depending on what record type they are associated with.
1 resposta
  1. 13 de jun. de 2019, 23:19
    @Matthew Linford

    It is important when you want to filter the picklist values according a record type but it is impossible with the describe methods of the object and the fields.

    PicklistEntry Class : the record type is still missing so you get all the values of the picklist for all the record types used by the object.

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Schema_PicklistEntry.htm⌗apex_class_Schema_PicklistEntry

    Getting Picklist values based on Record Type - Ideas - Salesforce 

    https://success.salesforce.com/ideaView?id=08730000000gNpLAAU

    There is this workaround (since v41.0): it is not the describe methods anymore but a call REST that can be done also with some apex code.

    https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_picklist_values.htm

    You can get the list of record types of an object but you cannot use them to filter the results of the describe of fields or get them from PicklistEntry.

    https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_class_Schema_RecordTypeInfo.htm⌗apex_class_Schema_RecordTypeInfo
0/9000