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

Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...