Skip to main content

Notifications

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

  • bdzevel Profile Picture
    970 on at
    Re: [AX2012] How to get "BatchRun" classes' parameter names

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

    I will look into SysOperation.

  • Verified answer
    Martin Dráb Profile Picture
    233,724 Most Valuable Professional on at
    Re: [AX2012] How to get "BatchRun" classes' parameter names

    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
    Re: [AX2012] How to get "BatchRun" classes' parameter names

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

  • Martin Dráb Profile Picture
    233,724 Most Valuable Professional on at
    Re: [AX2012] How to get "BatchRun" classes' parameter names

    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
    Re: [AX2012] How to get "BatchRun" classes' parameter names

    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
    233,724 Most Valuable Professional on at
    Re: [AX2012] How to get "BatchRun" classes' parameter names

    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.

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics AX (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 100 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 48

#3
Zain Mehmood Profile Picture

Zain Mehmood 6 Moderator

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans