function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
domdickdomdick 

controller class action

Hello,

 

Background:

Currently I have Custom controller that will select the Product services and insert OLI into relevant Opportunity. And OLI is creating revenue schedule if there is any.(via trigger after insert)

 

Also:

I have validation rule (under OLI) in place that check: AND(Hasrevenueschedule, Ischanged(unitprice))

 

How can i insert the child record(OLI schedule) after parent(OLI) has been saved. Can i use same controller class to insert child record? so i can avoid validation to execute.

 

Thanks,

ekorzekorz

I'm not certain I understand exactly, but if you're trying to use a trigger to create a parent and child record at the same time, I had this issue a month or so ago.  The contributer who solved my question broke down the solution very clearly, so here's the link:

 

http://boards.developerforce.com/t5/Apex-Code-Development/Trigger-that-builds-a-parent-amp-child-records-from-existing/td-p/617387

 

Hopefully that helps!