SBX - Search With Button

SBX - Forum Post Title

Error to create batch job using menu item

Microsoft Dynamics AX Forum

Rafael Pinheiro Araujo asked a question on 13 Sep 2018 6:34 AM

Question Status

Suggested Answer

Hi guys!

I have created a menu item to create a specific batch job, but after click on OK button, show an error. Could help me?

Reply

HI Rafael,

Can you tell what exactly has been created as customization? Did you verify other standard objects as reference about what might be missing here?

Reply
Crispin John Augustine responded on 13 Sep 2018 7:26 AM
My Badges

Your menuitem properties look wrong.

Object, Parameters properties have to be revisited.

Can you confirm if FF_CoupaVendors is the Controller class for this Batch Job?

Reply

Hi Rafael,

Can you also share the contents of the main method which you are trying to start? Does it have required parameters to be filled? If so, try to create a method like the blog without required parameters.

Reply
Rafael Pinheiro Araujo responded on 14 Sep 2018 7:12 AM

I changed the class extends to RunBaseBatch.

The code in main method is:

static void main(Args _args)

{

   FF_CoupaVendors vendors = new FF_CoupaVendors();

   if (vendors.prompt())

   {

       vendors.run();

   }

}

I changed the Menu item object to FF_CoupaVendors.

The batch is working if I do not add in to "Batch processing".

The batch job log is:

System.InvalidCastException: Unable to cast object of type 'Dynamics.Ax.Application.FF_CoupaVendors' to type 'Dynamics.Ax.Application.Batchable'.

  at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 30

  at Dynamics.Ax.Application.BatchRun.runJobStatic(Int64 batchId) in BatchRun.runJobStatic.xpp:line 13

  at BatchRun::runJobStatic(Object[] )

  at Microsoft.Dynamics.Ax.Xpp.ReflectionCallHelper.MakeStaticCall(Type type, String MethodName, Object[] parameters)

  at BatchIL.taskThreadEntry(Object threadArg)

Reply
Sona Jee responded on 14 Sep 2018 7:21 AM

Hi Rafael,

Take a look at this discussion:

stoneridgesoftware.com/batch-processing-in-dynamics-ax-2012-using-sysoperation-framework

Regards

Sona Jee

Reply
Rafael Pinheiro Araujo responded on 14 Sep 2018 8:12 AM

I did, but I got the same issue.

Reply
Rustem Galiamov responded on 17 Sep 2018 1:18 PM
My Badges
Suggested Answer

Hi Rafael Pinheiro Araujo!

Check this link: https://community.dynamics.com/ax/f/33/t/144116

Reply
Rustem Galiamov responded on 17 Sep 2018 1:18 PM
My Badges
Suggested Answer

Hi Rafael Pinheiro Araujo!

Check this link: https://community.dynamics.com/ax/f/33/t/144116

Reply

SBX - Two Col Forum

SBX - Migrated JS