Hi team,
I wrote below code to enable or disable the buton.
class SalesInvoiceOrgActiveEventHandlers
{
///
/// to enable or disbale SalesInvoiceOriginal button based on setup in Cust parameter.
///
///
///
[FormDataSourceEventHandler(formDataSourceStr(CustInvoiceJournal, CustInvoiceJour), FormDataSourceEventType::Activated)]
public static void CustInvoiceJour_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
#Define.SalesInvoiceOriginal('SalesInvoiceOriginal')
CustInvoiceDuplicateTable_W custInvoiceDuplicateTable_W;
CustInvoiceJour custInvoiceJour = sender.cursor();
FormRun element = sender.formRun();
FormControl SalesInvoiceOriginal = element.design(0).controlName(#SalesInvoiceOriginal);
FormDataSource custInvoiceJour_ds;
CustParameters custParameters = CustParameters::find();
// This condition is to added to control the SalesInvoiceOriginal button to get disable once the report got executed for 1st time
// for the current record.
if (custParameters.RestrictOrgPreview == NoYes::Yes && custInvoiceJour.OrgPreviewPrint == NoYes::Yes)
{
SalesInvoiceOriginal.enabled(false);
}
else
{
SalesInvoiceOriginal.enabled(true);
}
}
}
The button is working fine for enabled or disbaled. Once I refreshed the form then only it work properly.
I am looking for enabled or disabled the button without refreshing the form. Kindly let me know what to do?
Please give me more shed on this.
thanks!