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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

selected rows in a grid

(0) ShareShare
ReportReport
Posted on by 120

Dear Friends

I have this script in click button method :

void clicked()
{
XDSServices xdsServices = new XDSServices();
boolean ret;
// Added by Jamil Alshaibani at 20/3/2019

Args _args;
InventTransferTable _inventTransferTable;
FormDataSource _inventTransferTable_DS;
;
_inventTransferTable = _args.record();

// if(_inventTransferTable.dataSource())

if (_args &&
_args.caller() &&
classidget(_args.caller()) == classnum(syssetupformrun))
_inventTransferTable_DS = _inventTransferTable.dataSource();
for(_inventTransferTable = _inventTransferTable_DS.getFirst(true)? _inventTransferTable_DS.getFirst(true):
_inventTransferTable_DS.cursor();_inventTransferTable; _inventTransferTable= _inventTransferTable_DS.getnext())

{
info(strFmt("Current Transfer is :%1",_inventTransferTable.TransferId));
pause;

}
// End
}

I am getting this error

Error Message (03:44:03 pm) Args object not initialized.

Stack trace

(C)\Forms\InventTransferOrders\Designs\DesignList\ButtonInventTransferShip\Methods\Clicked - line 11

waiting for your valuable answer.

Best Regards

Jamil Alshaibani 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    You declare _args but never put anything to it so it's null.

    Your code looks like it should be in a class that is called from a menu item button. In those cases you can use the Args class to pass values from your form to your class. Basically your menu item button will automatically send an Args object that contains the caller object (your form) and record info (selected record(s) from the data source that is referenced in your button group.

    But if you write code directly on your form (like you do), no args are needed. You can just use the name of your form data source and call it directly.

    So, if your form has a data source called InventTransferTable, the only line of code that you need is "info(inventTransferTable.TransferId);"

    And you can also call InventTransferTable_ds.getNext() or any other method of the data source.

    Finally, you should use MultiSelectionHelper when you want to handle multiple selected records. Just search the web for more information and examples.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans