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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Jump Ref method D365FO

(0) ShareShare
ReportReport
Posted on by 384

Dears,

i am overriding the JumpRef() method on my form using the below code

  public void jumpRef()
        {
            FormRun formRun;
            Args args = new Args();

            super();
            args.lookupTable(tableNum(XXX)); 
           

            args.lookupField(fieldNum(XXX,ZZ));
            

            args.lookupValue(XXX.ZZ);
            

            args.lookupRecord(XXX::find(XXX.ZZ));
            

            args.name(formStr(YYY)); 
            
            
            formRun = ClassFactory.formRunClass(args);
            formRun.init();
            formRun.run();
            formRun.wait();
            formRun.detach();
        }

the issue is when i click on the ID in the List form to open the new form, it doesn't select automatically the selected ID in the new form but always the new form is selecting the first ID.

i found out that the query range used on the new form is affecting the jumpref() cause after commenting the query range code everything worked just fine.

Any idea how to use Jumpref with QueryBuildRange ?

if any other requirement are necessary please tell me.

Regards,

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: Jump Ref method D365FO

    First you find out whether you are getting the caller menu item. Just add the info log in the execute query method to display caller menu item. 

    Also get the caller record in form init method. Declare table buffer globally and on the init method you can assign values like below.

    TableName tableName1; //declare globally on form declaration.

    Now override the init method and get the caller record.

    tableName1 = element.args().record();

    so that you can use that buffer in the executeQuery method to add range and values.

    Thanks,

    Girish S.

  • waytod365 Profile Picture
    351 on at
    RE: Jump Ref method D365FO

    Thanks for your replay Grish,

    Below my code. 

    Args args = new Args();
    args.record(TableA);
    
    MenuFunction menuFunction = new MenuFunction(menuitemDisplayStr(FormB), MenuItemType::Display);
    menuFunction.formViewOption(FormViewOption::Details);
    menuFunction.openMode(OpenMode::Edit);
    menuFunction.run(args);
    
    
    //Form B
    
     public void executeQuery()
            {
                if (element.args().menuItemName() == menuItemDisplayStr(FormA))
                {
                    this.queryBuildDataSource().addRange(fieldNum(TableB, RecId)).value(queryValue(element.args().record().RecId));
                }
                super();
            }

  • GirishS Profile Picture
    27,825 Moderator on at
    RE: Jump Ref method D365FO

    If there is no direct relation between 2 tables you need to override the jump ref method.

    Have you done that? Can you share a code with us.

    Thanks,

    Girish S.

  • waytod365 Profile Picture
    351 on at
    RE: Jump Ref method D365FO

    Hi, actually i have same issue but, there is no direct relation.

    TableA and TableB 

    TableA has it refRecID and RefTableID.

    Issue: it's always open first record from TableB. (FormB)

    How to overcome this issue?

    I did it code from FormB excuteQuery

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Jump Ref method D365FO

    Try this:

    public void jumpRef()
    {
        Args args = new Args();
        MenuFunction menuFunction = new MenuFunction(MenuItemDisplayStr(TheMenuItemOfTheFormYouWantToOpen), MenuItemType::Display);
        
        args.record(MyDataSourceName);
        args.caller(element);
    
        menuFunction.run(args);
    }

    You should always use MenuFunction to launch forms, this way it takes into account security and only opens the form if your user has proper rights to open the form.

    Also, make sure that you have defined table relations from your table to the table that is opened by the JumpRef. If the relations are set up correctly, the form should be filtered based on the caller record.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: Jump Ref method D365FO

    Hi Sylvester,

    In the jumpref Method, try declaring "args.record()"

    In the form (YYY in your example) init() method, you can handle this condition with your QueryBuildRange.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,132

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 739 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans