0

I stumble upon this problem multiple times so far. I want to make workflow initiate automatically.(through apex code) All my workflow is doing is copying a field value.(This field is new so it is not affected by any trigger) My code snippet is running as expected, on logs I can see the workflow runs and update the field but on reality I cannot the field is not updated.

Logs:

12:29:45.592 (931700366)|WF_FORMULA|Formula:ENCODED:[treatNullAsNull]True|Values:
12:29:45.592 (931710018)|WF_CRITERIA_END|true
12:29:45.592 (932082146)|WF_SPOOL_ACTION_BEGIN|Workflow
12:29:45.592 (942730206)|WF_ACTION| Field Update: 1;
12:29:45.592 (942747241)|WF_RULE_EVAL_END
12:29:45.592 (942857210)|WF_ACTIONS_END| Field Update: 1;
12:29:45.592 (942871943)|CODE_UNIT_FINISHED|Workflow:OpportunityLineItem
12:29:45.592 (975465283)|DML_END|[28]

Any ideas? Thanks.

0

You might have another workflow/process/trigger that is setting the value back to null. Remember that during an update, workflows and triggers can be executed multiple times (recursion) so it's possible that the 2nd time around, the value is being cleared by another automation.

You'll have to look at deactivating other workflow/process/triggers until you see that the value remains, and then start activating them again one by one and see which one causes the new value to disappear.

2
  • Hey, Thank you for your help. I tried remove everything but no different result whatsoever. I am trying to copy a formula(currency) field to a currency field. maybe that is the reason? I tried different approach: copying the field with anonymous apex.same results though, some records can be copied but most of them just can't. Any ideas? It bothers me for a while now. Thank you! @CommonCoreTawan Apr 5 '20 at 18:08
  • No idea. If you try the exact same on a brand new object and it works, it would then confirm that there's some automation that you are not aware of, that is clearing out the value or preventing it from being placed. Apr 5 '20 at 18:53

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.