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
csrcsr 

How to pre default field values when a new record is created

Is there a way to predefault task due date to current date when a new task record is created? Also is it possible to copy over field data such as country or state from a contact record onto a new activity record created for this contact?
Benjamin_PirihBenjamin_Pirih
Do you have enterprise or above? This can be done with apex trigger- task on create..  you'll need to check the task whatId to retrieve the value from the contact.. unless you have a different primary identifier..
 
trigger task on create(
 
// set due date
 
// retrieve the update field
 
// update the field at task level
 
)
Benjamin_PirihBenjamin_Pirih
sorry whatid value is on the Task entity