Class extension for Form datasource methods in D 365

 // <summary>

/// Extension of SalesLine datasource in SalesTable form
/// </summary>
[ExtensionOf(formDataSourceStr(SalesTable, SalesLine))]
final class SalesTable_SalesLine_FDS_Extension
{
/// <summary>
/// Updates the <c>SalesLine</c> and form based on the item when changed.
/// </summary>


void itemIdModified()
{
next itemIdModified();

SalesLine salesLineLocal = this.cursor();

//TODO

}

void write()
{
next write();

FormDataSource fds = this;
FormDataSource fdsSalesLineGen = fds.formRun().dataSource(formDataSourceStr(SalesTable, SalesLine_General));

SalesLine_General salesLine_General;
if (fdsSalesLineGen)
{
SalesLine salesLine = fds.cursor();
salesLine_General = fdsSalesLineGen.cursor();
}

}

int active()
{
FormDataSource fds = this;
SalesTable salesTable;
int ret;

ret = next active();

salesTable = fds.formRun().dataSource(formDataSourceStr(SalesTable, SalesTable)).cursor();

if (//todo)
{
fds.allowEdit(false);
fds.allowCreate(false);
fds.allowDelete(false);
}

return ret;
}

public boolean modified()
     {
      boolean ret = next modified();
         FormComboBoxControl basIsVisbleCtrl = this;
         FormControl formCtl=this.formRun().design().controlName(formControlStr(SalesTable,BASCalcbtn)) as FormControl;
        if (basIsVisbleCtrl.valueStr() == 'Yes')
         {
             formCtl.enabled(false);
         }
         else
        {
            formCtl.enabled(true);
         }

 

        return ret;
     }

}



Comments

Popular posts from this blog

How to Create a wizard in x++ d365

X++ code to CREATE AND POST A TRADE AGREEMENT IN MICROSOFT DYNAMICS 365 in D365 F & O

x++ code to submit and approve and reject the invent movement workflow in d365 F&O