web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

[AX2012] How to get "BatchRun" classes' parameter names

(0) ShareShare
ReportReport
Posted on by 970

Hello,

I'm using the .NET Business Connector to run tasks (as in, batch job tasks).

1) I'm using the "pack" function of the "task class" objects to retrieve a list of parameters. I then get their types, so that I can understand a little bit more about the parameters. Is this correct (using the pack function)?

2) Most importantly, is there a way to simply retrieve a list of the parameters' names?

For example, I instantiate a "BusinessStatistics" object. I call it's pack function in order to get what I believe to be a list of its parameters. I check the types of the parameters, which tells me a little about what is expected to be passed. I use this information to pass in some (arbitrary) values. That's great, and if I go to the AX Client (GUI) to Batch Jobs > "View Tasks" > "Parameters" I can see the parameters there, but it would be nice to be able to retrieve a list of NAMES so that I know exactly what is expected in those fields. Maybe even whether or not they are required parameters. Is there a table for these parameters? 

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Although it can be done and it wouldn't be too much work for simple scenarios, there are many cases that increase the complexity to something what you surely don't want to cope with.

    You could scan the pack() or unpack() method for variable names - either by ScannerClass or using cross-reference, but it still could be difficult to understand. The class may also call an inherited implementation or call other methods so you would have to do it recursively... The number of potential issues is quite high.

    Using the values may be tricky too - you have to be able to serialize not just simple types, but also complex type - either custom types (with their own pack() method) or kernel types (like Map, for example).

    And it's still questionable how useful the variable names would be.

    I would recommend to look again at your requirements and think about another approach.

  • bdzevel Profile Picture
    970 on at

    There aren't any tables or anything with the names? Where does Microsoft get the display names from when you bring up the "Parameters" dialogue?

  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Depending on the implementation of the dialog, it can be defined in the dialog form (that is normal MorphX form), in the dialog() method or taken from extended data types.

    The relation between the dialog and packed variables is also quite loose - in the most simple example, I may show a dialog with no fields (just with Batch tab) but still pack the information about current time. Or I may ask for some values just to construct and pack a query.

  • bdzevel Profile Picture
    970 on at

    OK I understand.... so it's really just unfeasible to call "tasks" from X++, is it?

  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    I think it is near to impossible to do it generally. It still may be achievable if you limit what will be supported.

    I can imagine scenarios when it may be useful to plan a task from another application, but I would expect that you know at design time what and how to call. If you want all logic as in AX, it's better to use AX itself.

    But I have another idea for you - you might find SysOperation framework more suitable for your needs. For example, analyzing a DataContract class is surely much easier than looking into the pack() method.

  • bdzevel Profile Picture
    970 on at

    OK that is a very concise answer. Thank you very much, sir!

    I will look into SysOperation.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans