Posted on May 6, 2020 1 Comment
Coding question asked by Google Develop a Trigger on asset to count the amount of assets for a specific account. The value of the asset should increate on insert or undeleteand decrease on delete or reparent to a new account. Assumption: an asset cannot have a null AccountId, validation rule will fail and not save the record. […]
Posted on April 6, 2019 Leave a Comment
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 […]
Posted on May 2, 2014 Leave a Comment
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 […]
Posted on April 10, 2012 Leave a Comment
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) { […]
Posted on April 10, 2012 12 Comments
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); […]