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)

AX PASS MULTIPLE PARAMETER FROM ONE TO OTHER

(0) ShareShare
ReportReport
Posted on by

Hi 

I am able to pass single parameter from one form to other from the below code.Please send the code to pass multiple parameter using the below method.

void clicked()

{

 

    Args            _args;

    FormRun         _formRun;

    ItemRelation      _ItemRelation;

    AccountNum       _accountnum;

    PriceDiscAdmTrans apricediscadmtrans;

;

 

    _ItemRelation = PriceDiscAdmTrans.ItemRelation;

    _accountnum = PriceDiscAdmTrans.AccountRelation;

    apricediscadmtrans = pricediscadmtrans_ds.getFirst(true);

   

    _args = new Args();

    _args.name(formstr(GACC_PurchPriceHist)); 

    _args.caller(this);

    _args.parm(_ItemRelation);

    _args.parm(_accountnum);

    _args.record(PriceDiscAdmTrans);

    _formRun = ClassFactory.formRunClass(_args);

    _formRun.init();  

    _formRun.run(); 

    _formRun.wait();

    _args.parmObject( _args );

 

}

 

 

public void init()

 

{

    Query                   query;

    QueryRun                queryRun;

    QueryBuildDataSource    qbds;

    QueryBuildRange         qbr,qbr1;

        ;

    switch(element.args().dataset

{

 

case tablenum(PriceDiscAdmTrans): 

{

    _ItemRelation = element.args().parm();

    _accountnum = element.args().parm();

 

    query   = new Query();

    qbr = query.addDataSource(tablenum(PriceDiscAdmTrans)).addRange(fieldnum(PriceDiscAdmTrans,ItemRelation));

    qbr1 = query.addDataSource(tablenum(PriceDiscAdmTrans)).addRange(fieldnum(PriceDiscAdmTrans,AccountRelation));

   

    info(PriceDiscAdmTrans.getSQLStatement());

    PriceDiscAdmTrans_ds.query(query); // execution of the query

break;

    }

}

super();

 

}

 

Thanks

 

 

 

 

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Ivan (Vanya) Kashperuk Profile Picture
    on at

    Well, you can use args.parmObject(), generally speaking, or just reference a specific method on the caller, that would return a container or whatever collection object you want, and invoke it from the called form through element.args().caller().

    However, in your case, you pass in the record buffer PriceDiscAdmTrans, so maybe you can just rely on element.args().record() in the called form to get the two field values?

    Through the map, it could look like this:

       Map filters = new Map(Types::Int64, Types::String);

       Args args = new Args();

       filters.insert(fieldNum(PriceDiscAdmTrans, ItemRelation), 'some value');

       filters.insert(fieldNum(PriceDiscAdmTrans, AccountRelation), 'some 33');

       args.name(formStr(Form1));

       args.parmObject(filters);

    Note, however, that passing in object references is usually more error-prone than value types.

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