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
J Roge.ax1108J Roge.ax1108 

Trigger for Locking and Creating a new record each week

Hi Guys

 

Very new to the developer boards as I am just starting to learning this side of salesforce, I am wondering is it possible with a trigger to;

 

At a certain point in the week say a Friday evening lock a record and create a new record, which is a clone of the previous week which can be edited until the following week until the same cut off point? Is this possible with a trigger and how complicated would it be? Any feed back or tips would be greatly appreciated, below is a quick screen of what i am tiring to achieve :)

 

Thanks

 

J



 

What i am trying to achieve

cashworthcashworth

You could do this with a trigger yes but its not all that simple.

 

  • You will need to create a new record type for the object being cloned.
  • Go to the page layout on that new record type and mark all fields as read only
  • Create a formula field on your record that changes a date field into a day of the week string so that your record will update daily and when the value hits "Friday" your trigger should fire.
  • Create your trigger to perform the following operations:
  1. Clone the existing object
  2. Update the object being cloned to the new record type

That should achieve what your are looking to do here.