How to get calling menu name in extensions D365
We can write logic based on a current form called
from which menu item.
Following is the code that helps you to achieve get the calling menu name.
///
/// </summary>
/// <param name="args"></param>
[PostHandlerFor(formStr(CaseItemCreditLines), formMethodStr(CaseItemCreditLines, init))]
public static void CaseItemCreditLines_Post_init(XppPrePostArgs args)
{
SalesLine salesLine;
FormRun fromRun = args.getThis();
if(fromRun.args().dataset() == tableNum(SalesLine) &&
fromRun.args().menuItemName() == menuItemDisplayStr(CaseItemCreditLines))
{
salesLine =
fromRun.args().record();
fromRun.design(0).controlName(formControlStr(CaseItemCreditLines,
sendMail)).visible(salesTable::isRelatedPO_IsVOR(salesTable::find(salesLine.SalesId)));
}
}
Comments
Post a Comment