+ Start a Discussion
debradebra 

Flow error - sObject type 'Organization' is not supported.

I have a Flow that needs to do a lookup on some custom settings where the SetupOwnerId = OrgId.
However when an end-user runs the flow it produces this error (note as Sys Admin I can run the Flow)

Error element getOrgID (FlowRecordLookup).
This error occurred when the flow tried to look up records: ; nested exception is: common.exception.ApiQueryException: sObject type 'Organization' is not supported.

I also tried a Flow formula field set to be {!$Organization.Id} this produced errors as well.

Other posts seem to indicate that for user to see the Org data they need to have View All Data privs.  This is not possible for our data and since this is not Apex I cannot adjust the sharing. 
I hope not to have to had code the OrgId in a Flow variable as this is very bad practice as it would require Flow edits to move the Flow from Sandbox Orgs to Production.

Any suggestions?
Thanks!
Debra
Best Answer chosen by debra
Geoffrey BessereauGeoffrey Bessereau

Hey Debra,

I would probably create a custom label which contains that info, and then use a Flow Formula field to reference that label (seeing as you can't access labels directly otherwise).

You will still need to set the label in every deployment, but it is more maintainable.

Otherwise, store the organization ID on something the user can access (the User object for example) and fill it via a trigger on user creation/update. This is less elegant on a data structure level but has the advantage of being automated.

Cheers

All Answers

Geoffrey BessereauGeoffrey Bessereau

Hey Debra,

I would probably create a custom label which contains that info, and then use a Flow Formula field to reference that label (seeing as you can't access labels directly otherwise).

You will still need to set the label in every deployment, but it is more maintainable.

Otherwise, store the organization ID on something the user can access (the User object for example) and fill it via a trigger on user creation/update. This is less elegant on a data structure level but has the advantage of being automated.

Cheers

This was selected as the best answer
debradebra
Hi Geoffrey,

Thanks for the suggestions both seem reasonable/doable.  I'll check out custom labels - haven't used those before so something new!!!

Thanks
Debra