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 :
Microsoft Dynamics AX (Archived)

Identifying caller form AX 7

(0) ShareShare
ReportReport
Posted on by 1,104

Hi Experts,

How to identify caller form in AX7.

For e.g. Serial number dimension field is available in many forms like Inventory transfer journal, Movement journal, Purchase order form etc.

When we click on Serial number, system will open a form (InventSerialLookup).

Is there any possibility to identify from which form InventSerialLookup is called?

Thanks,

N.Sridhar

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Sukrut Parab Profile Picture
    71,735 Moderator on at

    Just use find references to see from where it is called

  • Sridhar Narayanan Profile Picture
    1,104 on at

    Hi Sukrut,

    When we click on Serial number, system will open a form (InventSerialLookup). Based on  from which form the Serial number is clicked, I have to perform some action.

    Basically, I have to identity the caller form at run time and perform some action based on that.

    In AX 2012 in the init method of the form , we will use element.args().caller();

    I am asking for similar kind in AX 7.

    Thanks,

    N.Sridhar

  • Sridhar Narayanan Profile Picture
    1,104 on at

    Any guidance.

  • Verified answer
    Martin Dráb Profile Picture
    239,213 Most Valuable Professional on at

    element.args().caller() is still available in AX 7. You should tell us what problem you have with it.

    By the way, is checking the caller name really a good design? What business problem are you trying to address by this technical solution?

  • Sridhar Narayanan Profile Picture
    1,104 on at

    Hi Martin,

    Requirement is to create multiple transfer journal lines for the multiple serial numbers selected.

    OOB AX does allow to select only one serial number; but, we have customized to select  multiple serial numbers by setting multiselection property to true and showRowlabel property to true.

    Multipleselection of serial number should work only when InventSerialLookup is opened from Inventory transfer journal form.

    Thanks,

    N.Sridhar

  • Martin Dráb Profile Picture
    239,213 Most Valuable Professional on at

    Sorry, I don't see the explanation of your problem with element.args().caller().

    Alternative designs include using a different lookup form from "Inventory transfer journal form" and passing a parameters from there which you would check in InventSerialLookup (regardless of which form set this parameter, therefore you wouldn't have a hard dependency on a particular form name).

  • Sridhar Narayanan Profile Picture
    1,104 on at

    Hi Martin,

    I am enabling the multiselect property of the grid in InventSerialIdLookup form; and enabling this only when the form is opened from InventJournalTransfer and PurchTable.

    Below code has done the trick.

    [PostHandlerFor(formStr(InventSerialIdLookup), formMethodStr(InventSerialIdLookup, init))] public static void InventSerialIdLookup_Post_init(XppPrePostArgs args) { FormRun element = args.getThis(); FormRun callerForm = element.args().caller(); FormGridControl gridInventSerial = element.design(0).controlName('GridInventSerial'); FormGridControl gridItem = element.design(0).controlName('GridItem'); FormGridControl grid = element.design(0).controlName('Grid'); str callerFormName; callerFormName = element.args().caller().name(); if(callerFormName == formStr(InventJournalTransfer) || callerFormName == formStr(PurchTable)) { gridInventSerial.multiSelect(true); gridInventSerial.showRowLabels(true); gridItem.multiSelect(true); gridItem.showRowLabels(true); grid.multiSelect(true); grid.showRowLabels(true); } }
  • babalalex Profile Picture
    411 on at

    Hi Shridharan,

    Somehow same logic is not able to work in my case, as I am getting some error for fetching the callername.

    Below is the piece of code,

    /// <summary>
    ///
    /// </summary>
    /// <param name="args"></param>
    [PostHandlerFor(formStr(PurchCreateOrder), formMethodStr(PurchCreateOrder, init))]
    public static void PurchCreateOrder_Post_init(XppPrePostArgs args)
    {
                    FormRun element = args.getThis();
                    FormRun callerForm = element.args().caller();
                   str callerFormName;

                  callerFormName = element.args().caller().name();

     

    if(callerFormName == formStr(PurchTable))
                      info('From PurchTable');
    else if(callerFormName == formStr(SalesTable))
                      info('From SalesTable');
    }

    It is throwing error for the line which is marked in red.

    Unable to cast object of type 'Dynamics.AX.Application.PurchTable' to type 'Dynamics.AX.Application.PurchPrepayTable'. Less than a minute ago

    Kindly guide me I am already stuck with this small requirement of fetching callerform name in 365FO.

  • Suggested answer
    nmaenpaa Profile Picture
    101,172 Moderator on at

    Are you sure that's the line of code that throws the error?

    Anyway you should replace that line with

        callerFormName = callerForm.name();


    But to me it looks like your error is coming from somewhere else, since you don't have any casting to any table in this piece of code.

  • babalalex Profile Picture
    411 on at

    Yes it seems correct to me as well.

    I think it is the version Platform Update 12 which is not allowing me to use such piece of code.

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

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 26

#2
imran ul haq Profile Picture

imran ul haq 8

#3
André Arnaud de Calavon Profile Picture

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

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans