Thursday, October 29, 2015

AX 2012: Passing parameters between forms

Passing parameters between forms

The easiest way is to pass current record.
Just change button control's DataSource value for Example to CustTable if CustTable is in current Form data sources. Then in destination form init method:

public void init()
{
    CustTable cTable;
    ;
    super();

    // Check for passed arguments
    if( element.args() )
    {
        // get record parameter
        if( element.args().record() && element.args().record().TableId == TableNum( CustTable ) )
        {
            cTable =  element.args().record();          
        }
    }
}


Then in destination form init:

public void init()
{
    str             anyStringValueFromCaller;
    ;
    super();

    // Check for passed arguments
    if( element.args() )
    {
        // get string parameter
        anyStringValueFromCaller = element.args().parm();

//get record as parameter
CustTable custTable;
custTable=element.args().record();

    }
}

No comments:

Post a Comment

Table browser URL in D365FO

Critical Thinking icon icon by Icons8