onmodified field and activate method in form level

[FormControlEventHandler(formControlStr(CustParameters, CustParameters_KGSPPSendEmail), FormControlEventType::Modified)]

public static void CustParameters_KGSPPSendEmail_OnModified(FormControl sender, FormControlEventArgs e)



{

FormCheckBoxControl sendEmail = sender.formRun().design().controlName(formControlStr(CustParameters, CustParameters_KGSPPSendEmail));

FormStringControl emailTemplate = sender.formRun().design().controlName(formControlStr(CustParameters, CustParameters_KGSPPDefaultEmailTemplate));

if (sendEmail.checked() == NoYes::Yes)



{

emailTemplate.enabled(true);



}

else



{

emailTemplate.enabled(false);



}

}





[FormDataSourceEventHandler(formDataSourceStr(CustParameters, CustParameters), FormDataSourceEventType::Activated)]

public static void CustParameters_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)



{

FormCheckBoxControl sendEmail = sender.formRun().design().controlName(formControlStr(CustParameters, CustParameters_KGSPPSendEmail));

FormStringControl emailTemplate = sender.formRun().design().controlName(formControlStr(CustParameters, CustParameters_KGSPPDefaultEmailTemplate));

if (sendEmail.checked() == NoYes::Yes)



{

emailTemplate.enabled(true);



}

else



{

emailTemplate.enabled(false);



}

}


Comments

Popular posts from this blog

Data entites method calling sequence in D365FO

How to Extend Sales Order Update Functionality to Custom Fields in D365 Finance and Operations

To generate dimension and find the account value - KGSPMIDimensionUtility