Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to call method via dictTable in a batch job?

Posted on by Microsoft Employee

I have a program which calls dispay method via dict table. When I run it via job it is ok.

permissionSet.add(new ExecutePermission());
permissionSet.add(new FileIOPermission(_saveFilename + '.spm' , 'RW'));
CodeAccessPermission::assertMultiple(permissionSet);
dictTable = new DictTable(_record.TableId);
value = dictTable.callObject(_dspMethod, _record);

but when I add it to the batch job I get following error:

System.InvalidProgramException: Common Language Runtime detected an invalid program.
at Dynamics.Ax.Application.MyClassBatch.Run()
at Dynamics.Ax.Application.BatchRun.runJobStaticCode(Int64 batchId) in BatchRun.runJobStaticCode.xpp:line 54
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)

Is it possible to run in in the batch somehow or it needs to be rewritten?

*This post is locked for comments

  • Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: How to call method via dictTable in a batch job?

    Display methods can be called in batch . DO you know the exact line which throws this error ?

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,269 Super User 2024 Season 2 on at
    RE: How to call method via dictTable in a batch job?

    Hi Vaclav,

    Can you share how you created the class for the batch job? Note that the batch framework always needs to have CIL compiled coding.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans