Tuesday, September 12, 2017

Enable/Disable form control in Dynamics 365 for finance and operations

//Enable/Disable form control in Dynamics 365 for finance and operations

-> Create a post event handler method setFieldAccess of a standard form method for enable/disable functionality

Code Sample:
[PostHandlerFor(formStr(SSPropertyTable), formMethodStr(SSPropertyTable, setFieldAccessHeader))]
public static void SSPropertyTable_Post_setFieldAccessHeader(XppPrePostArgs args)
{
    FormRun             callerForm= args.getThis();
    FormDataSource      SSPropertyTable_ds;
    SSPropertyTable SSPropertyTableSet;

    SSPropertyTable_ds= callerForm.dataSource(1);
    SSPropertyTableSet= SSPropertyTable_ds.cursor();

    callerForm.control(callerForm.controlId(formControlStr(SSPropertyTable, SSPropertyStatus))).enabled((SSPropertyTableSet.Linked) ? true : false);
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...