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

How do i call the OriginalDocuments form by X++ ?

(0) ShareShare
ReportReport
Posted on by 1,087

Hi,

i'm trying to call the OriginalDocuments form from another form's button (inside clicked method). It should work the same way we could see in the LedgerTransAccount form. The only difference i can spot, is that i'm calling it via X++.

The args object contains a LedgerTrans record, which should be the only information required to do so. But when i call it by clicking my Button, i have zero records in the form.

The call is made this way (inside the clicked method of my button):

args = new Args();
args.record(myLedgerTransRecord);
args.caller(this);

new MenuFunction(menuItemDisplayStr(OriginalDocuments), MenuItemType::Display).run(args);

Any suggestions about what could be wrong with this?

Thank you in advance

regards

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: How do i call the OriginalDocuments form by X++ ?

    If you check the code of the form, it is quite obvious that it is doing initialization through the OriginalDocuments class.

    Have a look at there that what are the valid sources for the table argument passed in. Hint: search for commonArg as keywords.

  • vv1984 Profile Picture
    1,087 on at
    RE: How do i call the OriginalDocuments form by X++ ?

    Hi,

    thank you for your answer.

    The args record i'm passing to the form seems to be ok.

    The difference i lately spotted is the call to the datasource's method linkActive which fills the TmpLedgerBase temporary table.

    I can't find a way to call it by code (except adding some code right inside OriginalDocuments form's "init" method...)

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: How do i call the OriginalDocuments form by X++ ?

    linkActive operates on the parent forms' datasources, so if you check the query (right click > personalization > query tab) for the standard functionality and compare it against your one which does not work, you might spot the difference for the missing record context/range.

  • vv1984 Profile Picture
    1,087 on at
    RE: How do i call the OriginalDocuments form by X++ ?

    Hi,

    sorry, but i still don't get it.

    The form i'm calling is the standard OriginalDocuments form, and i'm passing it a LedgerTrans record (via the args object), the same way it happens in the standard LedgerTransAccount --> OriginalDocuments call

    If i compare the standard "Show original document" call with mine, the only difference i see is the missing call to the method linkActive. What triggers that call in the standard?

    I mean, we are both running the OriginalDocuments form. In the standard, the linkActive method is triggered, while in my custom call it is not..

    Thank you

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: How do i call the OriginalDocuments form by X++ ?

    LinkActive is explained in the documentation and I already mentioned above that you need to have a parent form that has a datasource which is related/linked somehow to the child form datasource (on the OriginalDocuments form).

    msdn.microsoft.com/.../formdatasource.linkactive.aspx

    As I said, you are not using a valid table (LedgerTrans cannot be found in the code in combination with the above mentioned commonArg, the caller record object) with the OriginalDocuments class that can be used for creating the records in the Tmp table, on which the linkactive could be called due to having a relation to the parent form DS.

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…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
AlissonGodoy Profile Picture

AlissonGodoy 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans