How to enabled document attached on processed records Dynamics 365 for finance and operations

In many cases, document attachment disabled on processed records. Usually this happened with respect to business requirements. For example when Purchased order invoiced and settled in ledger, attachment add, edit and delete can be disabled. Only existing attachment can be view on these documents.But some cases we have to forcefully enabled document attachment on these processed records.

I used following code snippet to enable the document attachment.

/ <param name="args"></param>
    [PostHandlerFor(formStr(DocuView), formMethodStr(DocuView, setEnabled))]
    public static void DocuView_Post_setEnabled(XppPrePostArgs args)
        FormRun formRun; 
			//= sender;
        formRun  =Args.getThis();"ctrlAdd").enabled(true);
        FormDataSource      DocuRef_DS =formRun.dataSource("DocuRef");



Ali Raza Zaidi, Microsoft ERP Consultant, Currently working for Business Experts Gulf in United Arab Emirates. Specialized in HR & Payroll, Supply Chain and Financials modules.