Archives

Apex FeedItem Trigger Share to Community

When uploading a new FeedItem we want to share it to a specific community. First thing we need to do is share the FeedItem to a community by sharing it to the User. As the documentation states: Only feed items with a Group or User parent can set a NetworkId or a null value for […]

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