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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Active Discussion

How to passing the values from child form to parent form

(0) ShareShare
ReportReport
Posted on by 100

Hi Friends,

I want to pass stringedit value child form to parent form.

For example: Am opening a formB from FormA i wants to pass the stringedit values from formB to formA. 

Thanks in advance.

*This post is locked for comments

  • Karthickks Profile Picture
    100 on at

    Hi Sukrut,

    I would like to pass from formb to formA.

    Thanks in advance

  • Heinz Schweda Profile Picture
    1,367 on at

    Hi,

    you can create a method on formA and call this method from formB using the element.args().caller-object.

    Example, Method on formA

    public void myMethod(str _str)
    {
        info(_str);
    }


    Call from formB

    if (element.args()
        && element.args().caller()
        && element.args().caller() is FormRun)
    {
        if (sysFormRun::hasMethod(element.args().caller(), identifierStr("yourMethod")))
        {
            element.args().caller().yourMethod("Hello World");
        }
    }


    Regards,

    Heinz

  • Karthickks Profile Picture
    100 on at

    Hi Heinz,

    Thanks you for reply.

    I placed the below code in closeOk method on my formB but it is failing to go inside first if statement i.e element.args() && element.args().caller() && element.args().caller() is FormRun . Please help me on this. Thanks in advance.

    if (element.args()

       && element.args().caller()

       && element.args().caller() is FormRun)

    {

       if (sysFormRun::hasMethod(element.args().caller(), identifierStr("yourMethod")))

       {

           element.args().caller().yourMethod("Hello World");

       }

    }

  • Karthickks Profile Picture
    100 on at

    Hi  Sukrut Parab,

    Add in init method but am not finding any difference.

  • Johnkrish Profile Picture
    781 on at

    Hi Karthickks,

    Just look into below code this will help you.

    In Form1

    public void getValueMethod(str s)
    {
    info(strFmt("From Form2 : %1",s));
    }

     

    void clicked()
    {
    Args args;
    FormRun formRun;

    super();

    args = new Args();
    args.caller(element);
    args.name( formstr( Form2 ) );

    formRun = classFactory.formRunClass( args );
    formRun.init();
    formrun.run();
    formrun.wait();
    }

    In Form2

    public void close()
    {

    super();

    if (element.args()
    && element.args().caller()
    && element.args().caller() is FormRun)
    {
    if (sysFormRun::hasMethod(element.args().caller(), identifierStr("getValueMethod")))
    {
    element.args().caller().getValueMethod("Pass the Text");
    }
    }
    }

  • Heinz Schweda Profile Picture
    1,367 on at

    Hi Karthickks, how do you open fromB?

    My code assumes that it is called via a MenuItemButton

  • Karthickks Profile Picture
    100 on at

    Hi Heinz Schweda,

    Thank you for your reply, Will check and get back with you.

  • Karthickks Profile Picture
    100 on at

    Thanks Johnkrish, Will check and let you know!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans