206k views
3 votes
Universal Containers tracks Positions as a custom object in a recruiting application. When position records are created, they have a status of New and are visible only to the position owner. Once a position goes through an approval process, the status is changed to Approved. How can a developer meet this requirement?

1) Create a formula field that updates the sharing on a position once the status changes to Approved.
2) Create an Apex trigger that automatically updates sharing on a position once the status is approved.
3) Create a workflow field update that updates a custom field called Sharing on a position once the status is 'Approved'.
4) Create a sharing rule that states that Approved positions are shared with the Entire Organization.

User Roger Liu
by
7.6k points

1 Answer

1 vote

Final answer:

A Salesforce sharing rule should be created to automatically share 'Approved' position records with the Entire Organization, which is the most suitable and maintenance-friendly option compared to coding an Apex trigger.

Step-by-step explanation:

The requirement described in the question involves changing the visibility of a record based on a status update in a Salesforce environment. The best approach to meet this requirement is to utilize Salesforce's sharing settings and automation features. A formula field cannot update sharing settings, so option 1 is not viable. Workflow field updates also cannot change sharing settings, so option 3 is ruled out. Therefore, options 1 and 3 are incorrect.

However, an Apex trigger (option 2) can indeed be written to update sharing settings, but it involves writing code and is more complex to maintain. On the other hand, sharing rules (option 4) are declarative (point-and-click) tools in Salesforce that allow for the automatic sharing of records based on certain criteria without the need for code. So, the correct approach is to create a sharing rule that specifies when a position's status changes to Approved, that record gets shared with the Entire Organization.

User Sagar Trehan
by
8.2k points