Disable Promptdialog that appears before Posting product receipt D365

it Causes issues for the client so client demanded that this dialog should be disabled and never popup, I would simply disable it from code but It’s from Application suite. any suggestions?

Suggestions about what? What is the problem? Are you asking what would be the implications of disabling it? Or do you mean that you don’t really know how to disable it? If so, what’s your specific problem with it?

Yes I don’t know hot to disable it, since it the method that calls it is of form PurchEditLines which belongs to Aplication suite and I can’t edit anything from Application suite model

An event Handler should help right?

Could you share detauils of the code with us, so we don’t have to spend time finding what you already have on hand?

if (this.mustPromptQty())
            {
                recommendedQty = purchFormLetter.recommendedSpecQty();
                if (recommendedQty != specQty.selectionAsPurchUpdate())
                {
                    boxFormOnceIsActive = true;

                    box = BoxFormOnce::construct();
                    box.parmDialogBoxType(DialogBoxType::YesNoBox);
                    box.parmDialogButton(DialogButton::Yes);
                    box.parmTitle("@SYS59372");
                    box.parmText(strFmt("@SYS102340", salesUpdateEnum.index2Name(specQty.selection()), salesUpdateEnum.index2Name(enum2int(recommendedQty))));
                    box.parmOwner(new SysDictClass(classIdGet(purchEditLinesForm)).name());
                    if (box.prompt() == DialogButton::Yes)
                    {
                        specQty.selection(enum2int(recommendedQty));
                        specQty.selectionChange();
                    }

                    boxFormOnceIsActive = false;
                }
            }

and this is the postrun event handler

[PostHandlerFor(formStr(PurchEditLines), formMethodStr(PurchEditLines, run))]
					public static void PurchEditLines_Post_run(XppPrePostArgs boxFormOnceIsActive)
                    {
                    
                    }

thinking about making BoxFormOnceIsActive=False. will this be ok?

It seems to me that all you need to do is return false from mustPromptQty(). And if you look into it, you’ll see that it return false if PromptQty field in PurchParameters table is set to No. If you want to always disable this dialog, simply change the value of the parameter (in GUI) and you don’t need any code at all.

If you want to use a conditon, e.g. to hide the dialog for receipts but keep it for invoices, use CoC (Chain of Command) on mustPromptQty. For example:

[ExtensionOf(formStr(PurchEditLines))]
final class MyPurchEditLines_Extension
{
	protected boolean mustPromptQty()
    {
		boolean showPrompt = next mustPromptQty();
	
        if ( ... a condition ... )
		{
			showPrompt = false;
		}
		
		return showPrompt;
    }
}

By the way, please don’t use pre-/post-method event handlers. Using CoC is easier, safer and it gives you extra options.

Thank you so much!