hi,
i need to make some changes to the standard form in
Cash and bank management > Inquiries and reports > Checks
so i created an extension of the form and added the required fields. i need to perform some functionality as well but i am not able to do anything since the entire form is not editable. on checking the datasourse property i fount the allowedit(), allowcreate(), allowdelete() all were set to NO.
so i created created a class and pasted the Oninitialized form datasource event handler and wrote the below code.
but it doesn't seem to be working.
public static void BankChequeTable_OnInitialized(FormDataSource sender, FormDataSourceEventArgs e)
{
BankChequeTable bankChequeTable ;
FormDataSource bankChequeTable_ds = sender.formRun().dataSource('BankChequeTable');
FormRun element = sender.formRun();
bankChequeTable_ds.allowEdit(true);
bankChequeTable_ds.allowCreate(true);
bankChequeTable_ds.allowDelete(true);
}
*This post is locked for comments
i tried doing both the methods you suggested. i wrote 2 oninitialized datasource event handlers since there are 2 datasources but that did not work.
so i tried writing it on the form level oninitialized event handlers but that too dint work, this is the code:
[FormEventHandler(formStr(BankChequeTable), FormEventType::Initialized)]
public static void BankChequeTable_OnInitialized(xFormRun sender, FormEventArgs e)
{
FormDataSource bankChequeTable_ds = sender.dataSource(formDataSourceStr(BankChequeTable, BankChequeTable ));
FormDataSource reasonTableRef_ds = sender.dataSource(formDataSourceStr(BankChequeTable, ReasonReferenceTable));
reasonTableRef_ds.allowEdit(true);
reasonTableRef_ds.allowCreate(true);
reasonTableRef_ds.allowDelete(true);
bankChequeTable_ds.allowEdit(true);
bankChequeTable_ds.allowCreate(true);
bankChequeTable_ds.allowDelete(true);
}
Or you can write your code on initialized of the form, after super of form's init() and enable both DS there. But it does not meter, try to enable both and see it will resolve your issue.
so then i need to copy the Oninitialized form datasource event handler for the second table and write the same code?
This form has 2 DS, second one is disabled as well. They are joined with outer join, so try to allow create\delete\edit for second as well.
hi,
yes i debugged the code. so first it hits the init method and the super in that method gets called. when super is executed, my code which i have written above gets executed. all the statements are getting executed but i still cant edit the form.
Hi Sanaa,
Are you sure that your code is built properly and actually get executed? Did you try to debug it ?
André Arnaud de Cal...
291,965
Super User 2025 Season 1
Martin Dráb
230,817
Most Valuable Professional
nmaenpaa
101,156