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
Gopal ChatGopal Chat 

I want a trigger or batch which count week based on Start date

I have 3  fields,start date ,week year count and week start ,i want to count all the week/Year based on start date.
for example start date is 12/01/2018,after 7 days the count will be 1/0,after next 7 days the count will be 2/0, after one year the count will be 0/1 based on start date 
Raj VakatiRaj Vakati
I will suggest to use the apex scheduler job that will run on every week and calculate the values 
Raj VakatiRaj Vakati
Refer this links
Abdul KhatriAbdul Khatri
If my below solution fulfill your requirements then I don't think you need to overkill yourself with a trigger or batch or schedule apex.

Change your week year count field to a formula field and run through a start date with the following forumla.
TEXT( CEILING ( ( TODAY() - DATE ( YEAR( TODAY() ), MONTH( Start_Date__c ), DAY ( Start_Date__c  ) ) + 1 ) / 7 ) ) + 
"/" +
TEXT ( YEAR ( TODAY() ) - YEAR ( Start_Date__c ) + 1 )
Sample wireframe
User-added image
Abdul KhatriAbdul Khatri
Was the solution helpful?