Before Create Custom Trigger - How to Indicate Error Message

Posted by Rollbase User on 27-Jun-2013 10:40

What is the proper way to indicate there was a problem from a custom trigger in "Before Create" action type? For example, if a sync process fails, I want the record to fail being created and drop the user back on the screen where they can edit the details of the new record. If I use a regular Exception, the user gets a full-screen error message, from which they can't navigate. The record is not created (as expected), but if they hit back and try to modify, when hitting "Save" they will get "This request has already been processed." If I use a TriggerException, the record succeeds anyway, and the message is displayed in a banner at the top with a green background. I like the banner message, but I don't want the record to succeed, because, well, I threw an exception for a reason. What is the proper way to prevent a "Before Action" function from finishing if an integration custom trigger fails?

All Replies

Posted by Admin on 15-Jul-2013 10:42
Hi Mr. Bachtold,

considering trigger execution depending upon another trigger, I suggest looking into data sharing between triggers (Page 191 of "Rollbase in Action", "Sending Data from Trigger to Trigger"). Quickly referencing, there are two methods which may help, rbv_api.setSharedValue() and rbv_api.getSharedValue().

I imagine the integration custom trigger updating a boolean variable which would reflect failure(0) or success(1) using rbv_api.setSharedValue(). Although the "Before Action" condition executes the function at the right moment, as you had described, there are certain cases where it shouldn't finish. Thus, I would include a conditional statement using rbv_api.getSharedValue() which would run the trigger as intended if true and simply return if otherwise.

I hope I was able to understand the issue completely and give helpful advice. Please let me know if I misunderstood the problem or if there's anything else I can do.


Corey Prak
This thread is closed