web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

How to Enable/Disable a field on the form by event handler method in Dynamics(D365). #dynamics #d365 #ax

Krishna Bhardwaj Profile Picture Krishna Bhardwaj 97

Here we have an OnModified event handler of RecordPriorToRAF form control(or we can say field). Now I'm going to enable and disable another form control

according to my requirement.

[FormControlEventHandler(formControlStr(PdsBatchAttrib, PdsBatchAttrib_RecordPriorToRAF), FormControlEventType::Modified)]

public static void PdsBatchAttrib_RecordPriorToRAF_OnModified(FormControl sender, FormControlEventArgs e)

{

// Get DataSource

PdsBatchAttrib batchAttrib   =   sender.formRun().dataSource(formdatasourcestr(PdsBatchAttrib, PdsBatchAttrib)).cursor() as PdsBatchAttrib;

if(Condition...)

{

// Disable MandatoryPriorToRAF field

sender.formRun().design().controlName(formControlStr(PdsBatchAttrib, PdsBatchAttrib_MandatoryPriorToRAF)).enabled(false);           

}

else

{

// Enable MandatoryPriorToRAF field

sender.formRun().design().controlName(formControlStr(PdsBatchAttrib, PdsBatchAttrib_MandatoryPriorToRAF)).enabled(true);

}

}

}

Comments

*This post is locked for comments