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
OK that is a very concise answer. Thank you very much, sir!
I will look into SysOperation.
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.
OK I understand.... so it's really just unfeasible to call "tasks" from X++, is it?
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.
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?
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.
Mohamed Amine Mahmoudi
100
Super User 2025 Season 1
Community Member
48
Zain Mehmood
6
Moderator