Wednesday, June 10, 2009

Dialog error when adding batch tasks to a batch job

If you enter a new batch task to a batch job manually, AX might not initialize the Parameters dialog properly.

AX call unpack of the task class, with the contents of the Batch.Parameters field, but since we are creating a new entry to the table this field is empty.

What AX should do, and what RunBase normally does, is then to call initParmDefault of the task class to initalize it with for example a base for example a base query.

Here is the code to insert in \Data Dictionary\Tables\Batch\Methods\showDialog in order to fix this issue.

// As RunBase normally would do, we need to
// call initParmDefault here, if there are no
// values to unpack
if (!runClass.unpack(this.Parameters))