You need to sign in to do that
Don't have an account?
$100 offer for help writing "simple" trigger?
Looking for a trigger solution to overcome one or both of these point-n-click drawbacks:
1) standard workflow not smart enough to update child records. (Doesn't know which child records to update. In this case, I want to update ALL child records (Quote Line Items).
2) Workflows cannot be fired off a formula field change.
If you think you can help teach me how to write this relatively simple trigger, please contact me at jbardet @ gmail.com.
I'd be happy to offer $100 for your time, and I apologize for my ignorance if I have underestimated the complexity of this trigger.
Regards,
Jeremy
skype: jeremybardet
Depending on your requirements this may actually be significantly more than just "a simple trigger". Do you want it to run in production, for example? :) How many records are in your object? More than 10k, if so then this is really one or more batch operations you are asking for not just a trigger - at least for 2)? How do you want errors to be handled?
The logic sound fairly simple but this is anywhere from a few hours to a few days of effort depending on exactly what you want.
If you haven't already you might want to post this to the jobs board.
mtbclimber - I want this trigger to affect only the record being modified, not all records in the ojbect. We just implemented Real Time Quotes, so the Quote object is very new to us. In fact, we have less than 100 records in the object!
Update to project.. some more specifics.
Here's my version.
Note that this does not cover fringe cases like "what happens if the status is changed back to an unapproved state" or such. Try this in your Sandbox, and if you like the behavior, let me know, I'll do up your test method and such for you.
There's nothing terribly unsound about Ritesh's submission, however, but there were some unnecessary extras.
Clarifications: Ritesh uses a "subquery", which results in an extra SOQL call. This might not be a problem now, but if later you have many triggers, you might need that one extra query. Also, The query I use limits the items that are returned (there is also a row-item limit). The actual "logic" should have worked as expected.
Some other notes: You need an additional trigger on QuoteLineItems if you're allowing them to be modified after the status is approved, etc. Honestly, you might be best off getting in touch with a developer and having a live conversation.
sfdcfox, thank you so much for your input.
Yes, I will need the records modifiable after intiial trigger.
re: your're version.
Error: Compile Error: expecting right square bracket, found 'QuoteId' at line 5 column 106
Tried troubleshooting myself comparing to syntax structure with Ritesh's code, but coudln't get it.
I had a typo... "WHRE" should be WHERE. My "E" key is sticky.
shame on me for not spotting that!
i'm a bit embarrassed to ask, but... All I do with the code at this point in the sandbox is go to setup>customize>quote>triggers, create a new trigger, paste in the code, then make sure it's active, correct? I did that, and not seeing the sales price update.
-Jeremy
Here's actually a better way:
The quote line items update their own values, and all the quotes have to do is advise their children members to update. This still uses two queries, but most importantly, if the include checkbox is checked on a single item, it will properly update its unit price values.
Let me know what you think.
It's not "auto-magical" in the sense that just having the code will be enough. You have to actually trigger a change that would cause the trigger to fire. Since you have such a small set of data, you could do this: Your Name > Debug Log > Execute Apex....
This works for up to about 7000 records (the transaction is often aborted around this size, despite governor limits).