0

Iam trying to get the list of sObject(Account, Case etc.,) and display in the screen flow picklist field.

For this i wrote the below method to get the List of Sobject.

    @InvocableMethod(label='Get SObject API Names')
    public static List<List<String>> getSObjectAPINames() {
        List<List<String>> sObjectAPINames = new List<List<String>>();
        List<String> objectAPINames = new List<String>();        
        Map<String, Schema.SObjectType> gd = Schema.getGlobalDescribe();
        for(Schema.SObjectType st : gd.values()) {
            if(st.getDescribe().isAccessible()) {
                objectAPINames.add(st.getDescribe().getName());
            }
        }
        sObjectAPINames.add(objectAPINames);
        return sObjectAPINames;
    }
    

Note: Iam new to Salesforce flow.

Approach what I am trying is, call the above method from the flow and display the value in the picklist field.

enter image description here

enter image description here

enter image description here

enter image description here

1 Answer 1

2

To display all the SObject as picklist in screenflow you may not need to call an Apex Class . You can directly use as below.

You can add the picklist component and add choice as 'Record Choice Set' and select object as 'Entity Definition' which we can use to query all the sobject details as below

enter image description here

With that single component I am able to see the Sobject Names as picklist values in Screen flow as below.

enter image description here

3
  • Created 'Record Choice Set' and select object as 'Entity Definition' and picklist value is showing none. Screenshot attached in the question part @SaiPraveen Kakkirala Commented Feb 28, 2023 at 11:02
  • 1
    Can you give maximum number of choices as some number and try Commented Feb 28, 2023 at 11:04
  • Yes Its woked, But Maximum Number of Choices supported is 200, what we need to do if need to display all values Commented Feb 28, 2023 at 11:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .