Hello Boilard, Andre,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that the error you're encountering is due to limitations in the SOQL FIELDS function when used with certain APIs and versions. Because, the FIELDS(ALL) and compound fields are not supported in the context you're trying to use them.
Solution
The error you're encountering is due to limitations in the SOQL FIELDS function when used with certain APIs and versions.
You can use this work around to resolve the issues:
- You can explicitly list the custom fields you need along with the standard fields. Example:
SELECT FIELDS(STANDARD), CustomField1__c, CustomField2__c FROM Profile WHERE Id = 'xxx'
- Retrieve the list of fields programmatically and construct the SOQL query dynamically.
Example: If you use Python.
# Pseudocode example
fields = get_fields_for_object('Profile')
field_list = ', '.join(fields)
query = f"SELECT {field_list} FROM Profile WHERE Id = 'xxx'"
#You can use the Salesforce `describe` call to get the field list for the object:
describe_result = sf.Profile.describe()
fields = [field['name'] for field in describe_result['fields']]
field_list = ', '.join(fields)
query = f"SELECT {field_list} FROM Profile WHERE Id = 'xxx'"
- For compound fields like Address, you typically need to handle the subfields individually. For instance, instead of querying
BillingAddress
, you queryBillingStreet
,BillingCity
,BillingState
, etc. - Finally, If possible, check if using a different API version or method (e.g., REST API, Bulk API) provides the needed functionality. Different versions may have different support for certain SOQL features.
Accept Answer
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful ** so that others in the community facing similar issues can easily find the solution.
Best Regards,
Sina Salam