Salesforce Fact #580 | Check issandbox in validation rule and formula

There is a field IsSandbox on Organization object which denotes whether the current org is a sandbox or not. But this field is not accessible using the $Organization global variable in formula field and validation rules.

So, in order to check issandbox, we can create a custom metadata with a checkbox field and set it to true for sandboxes and keep it unchecked for non-sandbox orgs. Then we can refer this record in formula field and validation rules.

Attached are the screenshots.




Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow