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
jessimcqjessimcq 

Trigger Help! Trigger to fire on particular day of the month.

Hi everyone! We're still plugging away at altering our system to work the way we need it to, and we've run into another snag.

 

On the Opportunity, we need the following to happen:

 

If  sales_commission_paid__c =/= null (date field)

    If it is currently the 16th day of the month

        If solution_specialist_paid_form__c == false

        

Then mark solution_specialist_paid_form__c true

 


From what I'm reading, this may or may not be possible. We need it to happen automatically, rather than after a record is created/edited. We tried a workflow, but as soon as the date is no longer the 16th the box automatically unchecks and we need it to stay locked.

 

It seems like such a simple thing, can anyone help us with a solution?

Thanks in advance!

Best Answer chosen by Admin (Salesforce Developers) 
Vinit_KumarVinit_Kumar

Trigger won't work here as Trigger gets invoked on a particular event like(insert,update,etc.).You need to create a batch class and needs to schedule it to run on 16th of every month.Please go through the below links for the same :-

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm // This will tell you about Batch Class and examples 

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm  // This will tell you how to schedule it

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch.htm  // About Batch apex

All Answers

Vinit_KumarVinit_Kumar

Trigger won't work here as Trigger gets invoked on a particular event like(insert,update,etc.).You need to create a batch class and needs to schedule it to run on 16th of every month.Please go through the below links for the same :-

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch_interface.htm // This will tell you about Batch Class and examples 

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_scheduler.htm  // This will tell you how to schedule it

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_batch.htm  // About Batch apex

This was selected as the best answer
jessimcqjessimcq

Thank you very much, Vinit! You are, as always, amazingly helpful!

Vinit_KumarVinit_Kumar

Jessi,

 

Happy to help !!