You need to sign in to do that
Don't have an account?
Phuc 2
Retrieve object from org based on condition
I need to retrieve the objects from an org only iff they have a field set associated to them. I know how to retrieve the sObjects from the org but is there a way to only retrieve the sObjects that have at least 1 field set associated to them?
Thnak you,
Michael
Thnak you,
Michael
You can do this by using the Salesforce Metadata API to retrieve a list of all field sets in your org, and then comparing the fields in each field set to the fields in the sObjects you want to retrieve.
Here are the general steps to achieve this:
Use the Metadata API to retrieve a list of all field sets in your org.
Loop through each field set and retrieve its associated sObject type.
Use the Salesforce Object Metadata API to retrieve the metadata for the sObject type.
Compare the fields in the field set to the fields in the sObject metadata.
If there is at least one matching field, retrieve the sObject records.
By following these steps, you can ensure that only sObjects with at least one associated field set are retrieved from your org.