Setting Assigned to Field on new Action Button - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Christine DeFrancescoChristine DeFrancesco 

Setting Assigned to Field on new Action Button

Good Morning, 

I just created a new Action button for opportunity that I need to set some predefined values.  I want to set the assigned to field to certain users based on the opportunity owner.  Ex:  Opportunity owner is "John Smith" then when button is chosen set the assigned to for task to "Jane Doe". 

I have 12 different possible owners and 4 different possible would be task owners. 

Thanks!

​​​​​​​
Evan PonterEvan Ponter
One option would be to setup a lookup field on the user object that lets you specify another user. Then be sure to populate this field on the user records for the 12 possible owners. Each one should be set to the user who will be assigned the task. In your quick action, you should be able to reference this field when setting the "assigned to" for the task.

If this gets more complicated, or you want to handle multiple automatic assignments, it might be worth setting up a custom object or custom metadata type (https://help.salesforce.com/articleView?id=custommetadatatypes_overview.htm&type=5) to handle the mapping for your 12 owners and 4 task owners. That way you can easily update those records if changes are needed and your automation won't need to be altered. If you go the custom object route, you could allow others in the organization to manage these records. The downside to this approach is you will have to use a flow to query for the correct mapping record and otherwise recreate the quick action experience.