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

How to call caller form level method in called form.

(0) ShareShare
ReportReport
Posted on by 32

Hello,

I want to get caller form level method in the called form, some one guide me how I achieve this in d365FO, let me explain this.

I have a VendOnHoldUpdate form on the onClicked  event of closeOk method  I want to called caller form (VendTable) level method.  

 

[FormControlEventHandler(formControlStr(VendOnHoldUpdate, CommandButtonOK), FormControlEventType::Clicked)]
public static void CommandButtonOK_OnClicked(FormControl sender, FormControlEventArgs e)
{
    FormRun    formRun = sender.formRun() as FormRun;
    FormRun     callerFormRun = formRun.args().caller();
}

I write this code and get this callerForRun but unable to get the form level methods.

Please advised.

Thank you,

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Abdul Shakoor,

    Have you manually type in the method name instead looking for IntelliSense to show?

    Try type in the method name manually and see if it works.

    Thanks,

    Girish S.

  • Shakoor Taj Profile Picture
    32 on at

    I have type the method name manually but it doesn't work.

    [FormControlEventHandler(formControlStr(VendOnHoldUpdate, CommandButtonOK), FormControlEventType::Clicked)]
    public static void CommandButtonOK_OnClicked(FormControl sender, FormControlEventArgs e)
    {
        FormRun    formRun = sender.formRun() as FormRun;
        FormRun     callerFormRun = formRun.args().caller();
    
        VendTable   vendTableLocal = formRun.args().record();
    
        callerFormRun.modifiedControlledField(
            fieldNum(VendTable, Blocked),
            fieldNum(VendTableChangeProposal, Blocked),
            vendTableLocal,
            VendTableChangeProposalField::OnHold);
    }

    modifiedControlledField is Private method of VendTable form.

  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Method "modifiedControlledField" is private - Private method cannot be accessed from the event handlers.

    You need to think other way for solving this issue. This wont work for your scenario.

    Thanks,

    Girish S.

  • Shakoor Taj Profile Picture
    32 on at

    Can you suggest me other way.

    thanks.

  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    My suggestion will be you need to create same method in the "VendTable" form through extension and method access specifier must be public(Same code logic as standard - Method name would be different).

    So in the "VendOnHoldUpdate" form - On the clicked method you can call the custom method you created instead of standard one.

    Thanks,

    Girish S.

  • Shakoor Taj Profile Picture
    32 on at

    thank you for your suggestion and prompt response.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 660 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 549 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 307 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans