Skip to main content
Dynamics 365 Community / Forums / Finance forum / Disabling Datasource d...

Disabling Datasource differnet from the sender in EventHandler

editSubscribe (0) ShareShare
Posted on by
Hi everyone, i have task where i need to disable the Datasource(SalesLine)  in the forum SalesTable when the SalesEditLines is open.
to do so i used an event handler like this
[FormEventHandler(formStr(SalesEditLines), FormEventType::Activated)]    public static void SalesEditLines_OnActivated(xFormRun sender, FormEventArgs e)    {        Args    args;        FormRun formRun;        Args = new Args(formStr(SalesTable));        formRun = New FormRun(Args);        FormDataSource SalesLine_ds = formRun.dataSource(formDataSourceStr(SalesTable, SalesLine ));                SalesLine_ds.allowEdit(false);    }
but i always getting /Object reference not set to an instance of an object./ for SalesLine_ds.
thank you in advance for your help.