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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

X++ form initialize datasource not picking record.

(1) ShareShare
ReportReport
Posted on by 24
Hi Experts,
need to initialize InventTransferJour form with selective records and then mark them to pass To Cancel them in one go.

Args args = new Args(formStr(InventTransferJour));
 FormRun formRun;
 FormDataSource formDataSource = new FormDataSource();
 formRun = ClassFactory.formRunClass(args);
 formRun.init();
 formDataSource = formRun.dataSource();
 formRun.run();
 formDataSource.filter(fieldNum(InventTransferJour,UpdateType),enum2Str(InventTransferUpdateType::Shipment));
 formDataSource.filter(fieldNum(InventTransferJour,CreatedBy),/XXXUser/);

 
tried all option for marking but the records are not getting marked(markAllLoadedRecords(),mark().
tried one by one as well but buffer is not getting populated.
 
inventTransferJour = formDataSource.getFirst();
while(inventTransferJour)
{
    formDataSource.findRecord(inventTransferJour);
    formDataSource.mark(true);
    inventTransferJour = formDataSource.getNext();
}
 
after marking i need to call InventTransferMultiShipCancel to cancel marked records.
 
InventTransferMultiShipCancel InventTransferMultiShipCancel = InventTransferMultiShipCancel::construct();
ttsbegin;
RunBaseMultiParm::initFromForm(InventTransferMultiShipCancel, _args);
InventTransferMultiShipCancel.runOperation();
ttscommit;
 
please help if i am missing something
I have the same question (0)
  • Suggested answer
    Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi Community member,

    In general, here's how you can use multi select records from a form.
     
                    MultiSelectionHelper        multiSelectionHelper    = MultiSelectionHelper::construct();
                    multiSelectionHelper.parmDatasource(Table1_ds);
                    Table1 table1 = multiSelectionHelper.getFirst();
        
                    while(table1)
                    {
                        //logic
        
                        table1 = multiSelectionHelper.getNext();
                    }
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,803 Super User 2026 Season 1 on at
    Hi,
     
    you can try this :
       public static void main(Args _args)    
       {
            InventTransferJour  inventTransferJour;
            select inventTransferJour where ....
            _args.record(inventTransferJour);
            InventTransferMultiShipCancel InventTransferMultiShipCancel = InventTransferMultiShipCancel::construct();
            ttsbegin;
            RunBaseMultiParm::initFromForm(InventTransferMultiShipCancel, _args);
            InventTransferMultiShipCancel.runOperation();
            ttscommit;
        }
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • RK-27040840-0 Profile Picture
    24 on at
    I need to initialize around 6000 records shipped by a specific user and then cancel all in one go,for this i need to initialize the form and mark all records and pass it to 
    RunBaseMultiParm::initFromForm(InventTransferMultiShipCancel, _args);
     _args contains the formRun with marked records.
     
    I see that the standard class have the capability to cancel multiple records in one go.
     
    kindly suggest in accordance.

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 797

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 589 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 534

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans