[SalesForce] Is it possible to include public group in workflow rule for any condition

I have to add one condition for workflow rule in which this rule should be fired if user is from public group or other group.Is it possible by using workflow or process builder.

Best Answer

It is not possibly to directly check if the user is a member of a public group in a validation rule or workflow. However, there is a reasonable alternative without having to resort to writing a trigger.

  1. Create a Custom Permission that is named something relevant: "Fire XXX Workflow"
  2. Create a Permission Set that is named similarly: "Allow Fire XXX Workflow"
  3. Add the Custom Permission created in step 1 to the Permission Set. (You can also assign it to existing profiles/permission sets if appropriate)
  4. In the Workflow or Validation rule, use the "Formula Evaluates to True" setting. Then use $Permission->Fire_XXX_Workflow as part of the criteria. (You can use the "Insert Field" button to pick the permission).
  5. Add the users to the Permission Set created in step 2
  6. Optionally create a Delegated Admin Group and allow it to assign users the Permission set so that managers can maintain the users.
Related Topic