I have recently encountered an issue, which I do not seem to be able to resolve. I have set up an approval process that fires up if my PickList__c is evaluated true to the following value (or entry criterion): 'New'. When clicking on 'Submit for Approval' the PickList value changes to 'Approved', but prior to that I am running a trigger validation on two mandatory fields on the object (Custom_Field1__c and Custom_Field2__c). Currently, I have some logics on a before insert and before update trigger and I can use add.Error to return the error message on the fields. I would like the error(s) to be thrown on the same page, instead I am redirected to a second screen (titled Choose Approver) that looks like this:

enter image description here

I have a couple of questions:

  • Why is it redirecting me to the Choose Approver page?
  • Is it possible to return the error on the object? Is this possible to return it on the actual fields?
  • Am I correct in including the validation on the before insert and before after trigger?

Ideally, I would like to be able to have the error displayed on the fields, but in second instance I can also consider customising the error on the second screen.

Any suggestion is more than welcome!

Thank you for your help,



  • So your approval process does a field update upon entry and that is what is causes the triggers to execute?
    – cropredy
    Feb 14, 2015 at 1:23
  • The trigger will execute on before insert and the logics within it checks if Custom_Field1__c and/or Custom_Field2__c are null AND if the workflow field updates to 'Submitted'. Is that correct?
    – panza
    Feb 14, 2015 at 20:47

1 Answer 1


Yes, you need to add the error logic into the trigger before trying to insert

Something like

boolean b = false;

if(custom_field__c == null){ //test for the error
    custom_field__c.addError('your error message');
    b = true; //set the boolean to true so that update can't happen
if(b==false){ //only when there are no errors can you update
    update custom_object__c;
  • thank you for this. Will this show the error message on the second screen? - this is what I would like to avoid
    – panza
    Feb 14, 2015 at 20:49
  • No, this will only show the error on the first screen. Let me know if it doesn't!
    – rwegner7
    Feb 15, 2015 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.