function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Lori_Lori_ 

How default custom Activity field based on Assigned value?


We have a custom picklist, "Business Practice", on Activities.


We would like the "Business Practice" field to default to the the assigned person's role.


Activities can be entered two ways:

- by the team member (team member assigns themselves to the task)

- by the executive assistant (assigns the task to the team member)


Role hierarchy

--------------

System Admin

  - Exec Asst (Eric)

    - Practice A leader (Abby)

      - Practice A  team member (Adam, Anthony, Amy)

    - Practice B leader (Ben)

      - Practice B team member (Beth, Bob)

    - Practice C leader (Carla)

      - Practice C team member (Cathy, Carter, Cassy)

 

Anthony and Amy set their own appointments (default Business Practice to A).

Bob sets his own appointments (default Business Practice to B).

Cathy, and Cassy set their own appointments (default Business Practice to C).


Eric sets up appointments for:

- Adam (default Business Practice to A)

- Beth (default Business Practice to B)

- Carter (default Business Practice to C)


Any suggestions on how to accomplish this?  Or is there a better way to do this?

 

Thank you.


EnthEnth

If only Owner behaved the same way as Created By or Last Modified By you could simply set the default formula. However, it doesn't (worth voting on the idea) so try the following.

 

The only practical way I can see to do this is with an Apex trigger on the Event and/or Task. If you add a Business Practice custom field to the User object you can look up the Activity Owner in the trigger and change the Business Practice.  You can then chose whether to update the business practice when the owner is re-assigned.

 

if you'd rather not have the custom field on User then by all means put the logic into Apex but you'd then have to change your Apex every time you change your role structure or practices.