1

I create an automation variable in Dynamics 365 Business Central On Premise.

This code work fine the first time but then an error apear.

Code:

EVALUATE(_PC, PCStr);

CREATE(_Export, TRUE, TRUE);

_Export.process(_PC);
JMarR
  • 55
  • 7

1 Answers1

1

This happen because you never clean your automation variable. You have to use CLEAR() sentence.

Example:

EVALUATE(_PC, PCStr);
CLEAR(_Export);//to clean your automation
CREATE(_Export, TRUE, TRUE);
_Export.process(_PC);
Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29
  • Isn’t it cleared automatically when variable goes out of scope? – Mak Sim Feb 21 '20 at 04:42
  • It depends, I imagine that it is a global variable the code is executed with a button for example and you do not clean the variable you have an error: "The automation variable has already been create", If the variable is local it works fine. – Jonathan Bravetti Feb 21 '20 at 13:57