Validate trigger updates?

Posted by Rollbase User on 02-May-2012 05:20

Is there a way to get validations running on the changes made by triggers? I have a trigger connected to a workflow action. The trigger updates one field. I want to allow users to click the workflow action link to run that trigger. But I want the validations to run and prevent invalid data. I see in the debug window that the validations do actually run. However, they seem to run before any field updates have occurred, so the validations don't see any of the changes. This means that invalid data is getting through. Is there any way to get those validations to stop the original trigger if the original trigger is trying to update the record with invalid data? Thanks - Nathan

All Replies

Posted by Admin on 02-May-2012 08:45

Hello,



Have you tried placing the updatefieldvalue within the validation itself? Then probably not using the trigger. Since you are running validation before update, it is expected that you have checked the data even before the update trigger runs, which would probably be set to after update.



This way while checking the data you can either return an error or update a field.



Another approach would be to add validation within your update trigger itself.



If you could give more details or actual code I can check this more.



Thanks,

Piscoso, Martin

Rollbase

Posted by Admin on 03-May-2012 07:04

Thanks for that, Martin. I'll give your suggestions a try. - Nathan

This thread is closed