- The base class: The AxdSend-class needs to derive from RunBaseBatch.
- The dialog: The dialog is built on the axdSend-form which does not provide the 'tab'-control for the RunBaseBatch-dialog. This form needs to be modified by adding a new tab-control named 'tab'. Otherwise you would get an exception from the buildControl-method in the DialogForm-class. Btw: The name 'tab' is hardcoded in the tabName-method of the same class.
- The method sendMultipleDocuments: calling this method results in calling the run-method, and, as you know, batches are executed by calling the run-method...
Changing this would let the AxdSend-class be 'batchable', but unfortunately the class wouldn't be executable in the interactive mode anymore. This, because the dialog form from the AxdSend, which is opened by calling the prompt-method, requires these members being initialized:
- aifDocumentClassId
- serviceClassId
- aifConstraintList
- aifSendMode
- sendActionType
- aifActionId
My suggestion here is to create a new base-class for batchable AxdSend-classes to isolate these modifications as much as possible. You can download a private project that contains my modifications/new classes for Ax2009 in all concerned AOT-objects:
- AxdSend-class
- axdSend-form
- AxdBatchableSend-class (custom base-class)
- AxdSendExchangeRates as an example how to use the AxdBatchableSend class
The batch will use the endpoint that is stored in the usage-data. So the batch needs to be executed at least once in the interactive mode.
Important note:
Importing this project will overwrite these objects and overwrite all modifications in the same layer, too. Please be careful when importing the project.
These modifications are not compatible with Ax2012, but it requires only slight changes to adapt this to Ax2012. I will upload a project for Ax2012 once Ax2012 is released.
Update: (30/06/11) I fixed an issue with the initialization of the endpoint-list.
Update: (02/07/11) Ups, fixed an issue with the dialog initialization.
Update: (04/07/11) Sends only message if query returns more than one element.
Important note:
Importing this project will overwrite these objects and overwrite all modifications in the same layer, too. Please be careful when importing the project.
These modifications are not compatible with Ax2012, but it requires only slight changes to adapt this to Ax2012. I will upload a project for Ax2012 once Ax2012 is released.
Update: (30/06/11) I fixed an issue with the initialization of the endpoint-list.
Update: (02/07/11) Ups, fixed an issue with the dialog initialization.
Update: (04/07/11) Sends only message if query returns more than one element.
Hi Florian,
ReplyDeleteI've downloaded your xpo and installed it on our Ax 2009. When I tested the modified AxdSendExchangeRate it didn't work very well. There was not any batch tab and when I clicked the cancel button I got the following error:
"The object does not have the method batchinfo"
The stack says it is in
RunBaseBatch.prompt line 4 (if (dialogCaneceled && this.batchinfo())
/Lars
Hi Lars,
ReplyDeleteThe reason why it didn't work is that the Xpo didn't contain the AxdSend-Form. I did this, because I didn't want to change too much standard-object since I described the modification in the article.
I just uploaded a new Xpo on SkyDrive which includes this from. But please do a backup of this object if this has already been customized...
Kind regards,
Florian
Hi Florian,
ReplyDeletethank you for a comprehensive example. However, when running AxdSendExchangeRates and want to narrow the output down by specifying query values in the dialog (i.e currency code 'EUR') I still get all exchange rates - it does not seem as if the values are taken into account when the service is run. Is there some additional modification to the class needed?
/Jake
Do you have an AX2012 version (using SysOperations Framework)?
ReplyDelete