I have a trigger code and I am trying to insert large data on Order Name. I get the below error:

Update failed. First exception on row 0 with id 8014B000000HkuPQAS; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, OSM_OrderTrigger: execution of AfterUpdate caused by: System.DmlException: Update failed. First exception on row 0 with id 8024B000000JxXQQA0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, A workflow or approval field update caused an error when saving this record. Contact your administrator to resolve it. Order Name: data value too large: Order (max length=80):

How to do I resolve this issue?

  • 2
    The error is right there in front of you. It says Order name is more than 80 characters
    – RedDevil
    Jun 29 '17 at 11:55
  • Can we avoid this error by code ?how can we handle this exception Jul 17 '17 at 10:17

You put split the name and then put the name in field. You can try the following piece of code in your trigger.

String str = 'kjsbjkcbjkadbscjkbjkabscbabcbsakbcjkbsabclkbaskjcbkcsvdgcjsvdcjhsdvchjsdhvchjsdvhjcsdjcbajcascascajnckjnjjkBCKJbkjckjnzkjckjdskjcbkbdskc';
str= str.substring(0,80);
campaign  camp=new campaign ();
insert camp;

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.