You need to sign in to do that
Don't have an account?
scriptagent
Message Edited by scriptagent on 10-02-2008 07:14 AM
confirmation dialog...how ?
Hi,
I try to develop a trigger, which displays, if(customObject.newValue < customObject.oldValue), a popup (javascript) or a text warning . The customer should be able to change the newValue or to ignore the warning.
Unfortunately I don't have the right idea, how I can develop this or I don't know how I can call a javascript code in a Apex trigger.
I'm open for other suggestions or solution ideas too.
Hope you are able to help!
Thanks a lot! Peter
Message Edited by scriptagent on 10-02-2008 07:14 AM
All Answers
What you could do is :
1) implement the whole thing in Javascript (and put for example onChange events on the fields -> these could then call a javascript method displaying your pop-up with a window.open()
2) do your checks in the trigger comparing old and new values. When the new value < old value, reload the page but this time include a <script type="javascript">....</script> block that brings up your popup (which in turn could be a VF page that allows the user to pick the new value and update it from there before you close the window). I'm not sure if this'll work and it seems kinda messy to be honest.
3) Using no code at all you could create a validation rule on the object which will complain when newvalue < oldvalue. Add a checkbox field or something like that which the user can flag to override this behaviour (and make sure that your validation rule also looks at this flag, returning 'ok' whenever this is set, regardless of the new/old values. This will not give you the popup but it will accomplish what you're trying to do
David