Is there any way to get changes to OpportunityLineItemSchedule objects?

This is kind of a weird request – so bear with me. I need to detect changes in the OpportunityLineItemSchedule. Ideally i’d write a trigger against it but SFDC doesn’t allow triggers against this object. I found that you CAN write triggers agains the OpportunityLineItem – as it will update the LastModified field when a schedule is modified, firing the trigger on that item.

However, there doesn’t seem to be any way to detect changes in the schedule. My initial thought was to compare LastModified times between the LineItem and the Schedule, but I soon realized that the Schedule doesn’t have a LastModified field.

Context:
I have a customer that keeps track (at least within SFDC) of payments against the schedule by modifying the Description field on a Schedule object. They want to perform some actions when payments are made. I need to be able to get the amount of the Schedule that was paid. However, with this set up, I can’t tell which schedule items were modified (or even if any of them were modified at all).

I realize this isn’t an ideal way to track this information but it’s not my org so I’m somewhat limited in what I can do.

Answer

To really track this information, I think it would need to be held in some other object, like maybe concatenated into a text field on OpportunityLineItem(OLI):

Create a before update OLI trigger that checks for schedule updates, then takes all the Descriptions from the Schedule records (in a fixed order) and populates a text field on OLI: “paid $1000;paid $1100;;;;;”. You could even include the record Ids in this field if you need to: “00o000000000123: paid $1000; 00o000000000124: paid $1100;;…”. Then you can compare the old value of this text field to the current Description values on the schedules to see which one changed. This assumes that the OLI update does actually happen after the Schedule update, which I’m not sure about but seems likely.

Attribution
Source : Link , Question Author : Ryan Elkins , Answer Author : Jeremy Nottingham

Leave a Comment