+ Start a Discussion


how to write trigger on opportunitylineitemschedule.




Go to the Administrator -> Setup -> Customize -> Opportunity -> Triggers....





Hi amateur1,


There is a solution depending on your requirement.  But you cannot directly write a trigger for the opportunitylineitemschedule object.  I'm sure there's a valid reason why SFDC doesn't allow this but you just can't do it.  


The opportunitylineitemschedule object is "queryable" via SOQL which is good.  And anytime you insert or update the rows in the opportunitylineitemschedule object, the parent opportunitylineitem LastModifiedDate field changes.  So you could write a trigger on the opportunitylineitem object that then "goes down" to the child records and does something.  You won't be able to do validation type stuff with your trigger but you at least have a way to know when something changed.  In this example, you'll need to follow the suggestions on this board so that your trigger doesn't "go recursive".  And you'll need to take care of bulking issues for this type of solution.


Let me know if that helps,