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.

  • 1
    I am able to query the LastModifiedDate on OpportunityLineItemSchedule. Can you confirm that this won't work for you? Aug 23, 2012 at 4:19
  • I'll double check - I was mostly going off of documentation and it none of them listed that as a property. Aug 23, 2012 at 5:02
  • ...minutes later... It looks like it does have a LastModifiedDate. This should let me at least tell which records have changed by comparing the LineItem LastModifiedDate and the Schedule LastModifiedDate. Not what changed but it's a start. Aug 23, 2012 at 5:08
  • Ralph, I have tried your suggestion but it does not seem to be working. My before OpportunityLineItem trigger queries all the related OpportunityLineItemSchedule records. It builds a list of OpportunityLineItems from the trigger.old and uses that list to build a map of OpportunityLineItemSchedule records by querying against OpportunityLineItemSchedule. I print the resulting map in the debug log but the values in the OpportunityLineItemSchedule map are the new, changed values, not the old values. How are you getting a copy of the NEW OpportunityLineItemSchedule records? t/y MH
    – MWH
    Jun 23, 2013 at 16:11
  • Sorry, I meant How are you getting a copy of the OLD OpportunityLineItemSchedule records?
    – MWH
    Jun 23, 2013 at 16:38

3 Answers 3


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.

  • From comparing LastModifiedDate stamps it would appear they happen simultaneously, but I'll have to do more research to confirm that. Aug 23, 2012 at 14:27

do they support streaming API for this object, if yes that will be ideal to use in this case.


Potential Workaround

I've had a simliar requirement and was able to take advantage of the fact most changes (see caveat below) to the OpportunityLineItemSchedule table result in the OpportunityLineItem and Opportunity triggers being fired.

To detect the changes:

  1. Query the old related revenue schedules in a before trigger
  2. Query the new revenue schedules in an after trigger
  3. Compare the old and new revenue schedules for differences


In my case, I believe the reason the parent triggers were fired was due to the changes in the schedule causing changes to the line item and opportunity amount. You'll want to test that changes to the description field have the same trigger rollup effect.

  • 1
    Hi @Ralph first revenue schedules get committed in to DB and after that OLI before and after trigger get called. so when we query OLIS from before and after OLI trigger we get the updated values. We always get updated values in before and after OLI trigger. Dec 27, 2016 at 10:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .