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

Open Purchase Order Form from PO Number Link (JumpRef & InIt method extension - Event Handler)

(0) ShareShare
ReportReport
Posted on by 70

Hello,

Let me begin by mentioning the potential bug in the current D365 version. When we navigate:

Released Products / Manage Inventory - Transactions / Purchase Order Link (See the screenshots below)

  • When we click on link, it opens a new PO screen instead of opening with that specific PO# details. We made sure that PO# exists.
  • It is a product bug in my opinion but I could be wrong.

For our immediate need to resolve this, I have started extending this form by utilizing JumpRef and other form methods. But quite not getting what we expect.

So far, we have

1. JumpRef method Post Event Handler on InventTrans form's field method

[FormControlEventHandler(formControlStr(InventTrans, InventTransOrigin_ReferenceId), FormControlEventType::JumpRef)]
public static void InventTransOrigin_ReferenceId_OnJumpRef(FormControl sender, FormControlEventArgs e)
{

// Send Args with PO# (PurchTable Record)

PurchId purchid = sender.valueStr();
MenuFunction menuFunction;
Args args;
PurchTable purchTable = PurchTable::find(purchid);
FormRun formRun;

info(strFmt("Your PO Number is %1",purchTable.PurchId));
if(purchTable.RecId != 0)
{

args = new Args();
args.record(purchTable);
args.caller(sender);
args.name(formStr(PurchTable));
formRun = classFactory.formRunClass(args);

FormDataSource ds = formRun.dataSource(formDataSourceStr(PurchTable,purchTable)) as FormDataSource;

formRun.init();
formRun.run();
formRun.wait();

}

2. Init method on PurchTable - Pre-Event Handler

[PreHandlerFor(formStr(PurchTable), formMethodStr(PurchTable, init))]
public static void PurchTable_Pre_init(XppPrePostArgs args)
{

FormRun fr = args.getThis();
Common common = fr.args().record();
PurchTable purchTable;
if (common is PurchTable)
{
purchTable = common;
fr.args().lookupRecord();
}

}

We are able to pass PurchId when we click on from originating form to PurchTable form but it still opens a blank PO# form. 

Any thoughts or suggestions? Thank you in advance.

Screenshots for reference:

pastedimage1674337109170v1.png

pastedimage1674337117307v2.png

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

    Hi Ronak,

    Seems the Number field is standard one which already has jump ref - Meaning it will navigate PurchTable form with the specific record.

    Remove all your custom code and check whether its navigating to PurchTable form.

    Thanks,

    Girish S.

  • Ronak Brahmbhatt Profile Picture
    70 on at

    Hi Girish,

    Thanks for your reply. That's a problem I mentioned in the beginning.

    Out of box code open the Purchase Order form but it opens as "Blank" (instead of with that PO# and this PO# does exist).

    I am sure anyone can reproduce this issue if you follow:

                   Released Products / Select Product / Manage Inventory - Transactions / Purchase Order Link

    Thanks.

  • GirishS Profile Picture
    27,827 Moderator on at

    Yes I navigate to the above form and able to navigate to the Purch table form with the selected record.

    I think there is some customization which is causing the issue.

    Please debug the code and find out the issue.

    Thanks,

    Girish S.

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 544 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans