New answers tagged

0

Yes, I recently did have the same requirement and I ended up doing it with a Flow, that was much easier and quicker. In my scenario I had two fields that were equals on each object so that was the match I used.


0

You're running an after insert trigger, which means you need to do a separate update DML command to actually make the update. For this situation, if you just use before insert instead of an after insert, it should work as anticipated.


0

I strongly suggest you use trigger auto lunched FLOW ("Autolaunched Flow with a Record Trigger" fairly new functionality) instead of writing APEX trigger for that. The new trigger flows are made exactly for cases like that they will save you time and will serve you pretty good for the future. See trail head:https://trailhead.salesforce.com/content/...


1

Your code is incorrect in many ways. You are using before insert context to update other objects. This should be done in after insert. Your logic seems incorrect as the first loops takes all HPL_Policy_Section__c, but in second loop you are again trying to populate the same thing back You are using limit query in SOQL, what if there are multiple ...


0

Since you're modifying the same object that your trigger is on, you'll actually want to use a before trigger context here (it means you don't need to perform explicit DML as long as you're modifying the instance of the record stored in trigger.new or trigger.newMap, and you don't need to worry about an infinite loop). I think the piece that you're missing is ...


Top 50 recent answers are included