Hi All,
Recently I had a requirement to disable edit,create,delete access from LedgerJournalTransAsset form based on setup on the journal name.
I have used chain of command for the form to perform this function(bellow disabled code) . But i don't know hot to get datasource from active method.
I have also tried to use event handler method OnActivated. but this not work, when i debug the sender.allowEdit still on true.
=> Is there another way to disable edit,create,delete access of datasource, when user open the form, he shouldn't have access to change any thing(all fields)
Please find sample code below that i have tried :
[ExtensionOf(formStr(LedgerJournalTransAsset))]
//[ExtensionOf(formdatasourcestr(LedgerJournalTransAsset, LedgerJournalTrans))]
final class FFY_LedgerJournalTransAsset_Extension
{
[FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTable, LedgerJournalTable), FormDataSourceEventType::Activated)]
public static void LedgerJournalTable_OnActivated(FormDataSource sender, FormDataSourceEventArgs e)
{
sender.allowEdit(false);
sender.allowDelete(false);
sender.allowCreate(false);
}
[FormDataSourceEventHandler(formDataSourceStr(LedgerJournalTransAsset, LedgerJournalTrans), FormDataSourceEventType::Activated)]
public static void LedgerJournalTrans_OnActivated(FormDataSource senderTrans, FormDataSourceEventArgs e)
{
senderTrans.allowEdit(false);
senderTrans.allowDelete(false);
senderTrans.allowCreate(false);
}
/*
public int active()
{
boolean ret;
ret = next active(); // Next Keyword for performing chain of command – here parent init executed
if(ret)
{
LedgerJournalTrans_ds.allowCreate(FalseTrue::False);
LedgerJournalTrans_ds.allowEdit(FalseTrue::False);
LedgerJournalTrans_ds.allowDelete(FalseTrue::False);
}
return ret;
}
*/
}