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)

jumpref() how to find record about InventTrans::find(InventSum.ItemId)??

(0) ShareShare
ReportReport
Posted on by 319

Hello All,

I use jumpref() to make AX Data auto link to Ax Transaction Form.

Form InventSum inside Grid Field data ,when user click the data(number),

Ax will auto open the InventTrans form (by ItemId).

I use jumpref, but can't work.

I don't know how to get the record between the InventTans Table and InventSum Table.

Please help and Thanks.

==========================

My problem is:

below is my code that compile is OK.

but when in running (use mouse that right click the view detail function) get the error message:

Could not process the lookupRecord value on the Args instance. The table 'InventTrans' does not exist as a root FormDataSource for the form 'InventTrans'.

==========================>My code

public void jumpRef()

{

   //super();

   Args                        locArgs = new Args();

//*    DirPartyTable               locDirPartyTable;

   InventTrans                 inventTrans;

   locArgs.caller(this);

   // Find and set buffe ------ I don't know how to do this!!

inventTrans = InventTrans:: find (InventSum.ItemId);   // InventTrans no find ItemId method??

//*  locDirPartyTable = DirPartyTable::findRec(CustTable::find(SalesTable.CustAccount).Party);

   inventTrans.ItemId  =  InventSum.ItemId;

   // Set record

//* locArgs.record(locDirPartyTable);

   locArgs.record(inventTrans);

   locArgs.lookupRecord(inventTrans);

   new MenuFunction(menuitemDisplayStr(InventTransItemIdx), MenuItemType::Display).run(locArgs);

}

*This post is locked for comments

I have the same question (0)
  • nmaenpaa Profile Picture
    101,166 Moderator on at

    Yes, you are right that InventTrans has no find method for ItemId. This is because ItemId is not unique in InventTrans. So it's not possible to find one InventTrans record by using an ItemId.

    I would put an inventTable in the args since that's unique for every item id. And every other table that has ItemId field has a relation to inventTable.

    Also there is no menu item called "InventTransItemIdx", instead it's called "InventTrans".

    So it would be something like this:

    public void jumpRef()
    {
       InventTable inventTable = InventTable::find(inventSum.ItemId);
       Args                        locArgs = new Args();
    
       locArgs.caller(this);
       locArgs.record(inventTable);
       locArgs.lookupRecord(inventTable);
       new MenuFunction(menuitemDisplayStr(InventTrans), MenuItemType::Display).run(locArgs);
    }
  • Suggested answer
    Martin Dráb Profile Picture
    239,152 Most Valuable Professional on at

    First of all, let me format your code so it's easier to read. Next time, please clean it up before sharing and use the </> button in the rich formatting view to paste source code.

    public void jumpRef()
    {
        Args locArgs = new Args();
        InventTrans inventTrans;
    
        locArgs.caller(this);
    
        // Find and set buffe ------ I don't know how to do this!!
        inventTrans = InventTrans::find(InventSum.ItemId); // InventTrans no find ItemId method??
    
        inventTrans.ItemId  =  InventSum.ItemId;
    
        locArgs.record(inventTrans);
        locArgs.lookupRecord(inventTrans);
    
        new MenuFunction(menuitemDisplayStr(InventTransItemIdx), MenuItemType::Display).run(locArgs);
    }

    If you want to see all inventory transactions for a given item, trying to find a single inventory transaction and passing it as a parameter doesn't match your requirements. You don't want to display a single transaction.

    Also, why do you use jumpRef() in the first place? Such things can be usually done without code, just by using a menu item button. Look at InventTransItemIdx button in InventIOnHandItem form; it does the same thing you're trying to achieve.

  • ATMA-Jen Profile Picture
    319 on at

    Hello Martin,

    This case that I need to perform that when user direct click the on hand qty field,

    then AX  like a hyperlink to direct open about this Itemid's on-hand transaction.

    so why use jumpRef(), not add a menu button and transaction menu button is have in AX  default UI.

    but I still can't perform the hyperlink, need use right click the mouse and use view detail.

  • ATMA-Jen Profile Picture
    319 on at

    Hello  Nikolaos,

    I paste your code in AX and get a error message: please help and thank you.

    The Error Message:

    Could not process the lookupRecord value on the Args instance. The table 'InventTrans' does not exist as a root FormDataSource for the form 'InventTrans'.

  • ATMA-Jen Profile Picture
    319 on at

    Hello Nikolaos,

    Had get the error, please help and thanks.

    The Error Message:

    Could not process the lookupRecord value on the Args instance. The table 'InventTrans' does not exist as a root FormDataSource for the form 'InventTrans'.

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

    That's strange, I get a bit different error:

    Could not process the lookupRecord value on the Args instance. The table 'InventTable' does not exist as a root FormDataSource for the form 'InventTrans'.


    Anyway, seems we need a bit different solution.

    First of all, please remove the row with "locArgs.lookupRecord(inventTable);"

    Then go to the init method of InventTrans form, and add this logic after the super() call (I suggest you create a new method and call it from the init method):

        QueryBuildDataSource qbds;
        InventTable inventTable;
        
        if (element.args().record() && element.args().record().TableId == tableNum(InventTable))
        {
            inventTable = element.args().record();
            qbds = inventTrans_ds.query().dataSourceTable(tableNum(InventTrans)); 
            qbds.addRange(fieldNum(InventTrans, ItemId)).value(inventTable.ItemId);
        }

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 16

#2
GiacomoRovai Profile Picture

GiacomoRovai 4

#3
Douglas Noel Profile Picture

Douglas Noel 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans