Skip to main content

Notifications

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

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Open Purchase Order Form from PO Number Link (JumpRef & InIt method extension - Event Handler)

    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.

  • Ronak Brahmbhatt Profile Picture
    Ronak Brahmbhatt 70 on at
    RE: Open Purchase Order Form from PO Number Link (JumpRef & InIt method extension - Event Handler)

    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.

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Open Purchase Order Form from PO Number Link (JumpRef & InIt method extension - Event Handler)

    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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,971 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,846 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans