You need to sign in to do that
Don't have an account?
symantecAP
Trigger related Query
I have a Case Object and there are two child objects.
First child object is Provider
Second child object is Finished goods
and there is no relation between provider and finished goods.
can i write a trigger to update a field in Provider when there is change of field in finished goods.?
Is this achievable if so how?
Quickest answer I could think of, I'm sure there are more efficient/elegant ways. This will only fire if there is a single Finished Goods in the trigger. You'd need to decide on the logic of update the other fields if there were bulk inserts of Finished Goods. You'll also want to move the logic out of the trigger if it's going to be used often:
Consider it a proof of concept.
All Answers
Quickest answer I could think of, I'm sure there are more efficient/elegant ways. This will only fire if there is a single Finished Goods in the trigger. You'd need to decide on the logic of update the other fields if there were bulk inserts of Finished Goods. You'll also want to move the logic out of the trigger if it's going to be used often:
Consider it a proof of concept.
Hi,
Here is the sample trigger for the below functionality:
where Child1 is the first child object of case and child2 is the second child object of case.
The above code replaces the "Name" child2 with Child1 of case object.
Hope this helps.
Thanks
Not to knock the other answers, but both of those will cause errors with insert of multiple Child__1/FinGood__c objects. Having the update inside the loop without any control over the number of inserts will eventually cause a DML error. Something to keep in mind if you ever insert bulk objects.
Thank you so much Kbromer. The code worked just fine