How to set 'Allow Edit' property of the field of a form in event handler. #dynamics #d365 #ax
Views (71)
Here we have an OnModified event handler of MandatoryPriorToRAF form control( or we can say field). Now I'm going to set 'Allow Edit' property
as false according to my requirement.
[FormControlEventHandler(formControlStr(PdsBatchAttrib, PdsBatchAttrib_MandatoryPriorToRAF), FormControlEventType::Modified)]
public static void PdsBatchAttrib_MandatoryPriorToRAF_OnModified(FormControl sender, FormControlEventArgs e)
{
PdsBatchAttrib batchAttrib = sender.formRun().dataSource(formdatasourcestr(PdsBatchAttrib, PdsBatchAttrib)).cursor() as PdsBatchAttrib;
if(Condition...)
{
sender.formRun().design().controlName(formControlStr(PdsBatchAttrib, PdsBatchAttrib_MandatoryPriorToRAF)).allowEdit(false);
}
}

Like
Report
*This post is locked for comments