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:

