Archives

Apex save class when scheduled > ‘This schedulable class has jobs pending or in progress’

How do I develop in a class that is referenced in a scheduled job?You will see the following error when you try to save this class: This schedulable class has jobs pending or in progress There is the workaround, what I did is create a Job scheduler so basically 1 scheduled class from where I […]

Rate this:

Read More

Apex Trigger for Sales Rep Scoring

This trigger is used to track and score sales rep activities as they complete Account fields. Account Trigger Handler to Track specific field updates by sales rep and give points for based on which field was completed. Account Trigger Handler calls the SalesRepActivityScoring class to loop through all the accounts see which fields have been […]

Rate this:

Read More

Salesforce Update Product Schedule from Opportunity Product using Apex Trigger

Update the Product ScheduleDate when the Opportunity Product ServiceDate changes. First we create an OpportunityProduct Trigger to see when ServiceDate changes and parse the amount of days difference between the old and new date. trigger ProductDateUpdate on OpportunityLineItem (after update) { for (OpportunityLineItem oli: Trigger.new) { OpportunityLineItem oldCloseDate = Trigger.oldMap.get(oli.ID); if (oli.ServiceDate != oldCloseDate.ServiceDate) { […]

Rate this:

Read More

Salesforce Update Product Schedule from Opportunity using Apex Trigger

The tutorial below shows how you can use Salesforce Triggers to update the CloseDate of an opportunity and the associated Product Schedule. First thing is we must create a product Trigger, below is the code for the product trigger: trigger OpportunityScheduleUpdate on Opportunity (after update) { for (Opportunity o: Trigger.new) { Opportunity oldCloseDate = Trigger.oldMap.get(o.ID); […]

Rate this:

Read More