Hi folks, we all might have faced the situation where you needed to use the methods on datasources/controls of d365 standard forms.
Its much easier than you think, only drawback is you don't really have a power of intellisense on this.
But, who cares as long as it works.
Scenario:
Form: SalesTable
Datasource: SalesTableExt (Custom table)
Task: to fillup value in field salestable (recId of salesTable data) on datasource write method.
Attribute
In a similar way, we can use Coc on form controls. Only difference would be there on attribute for class, it would be like
and if needed on form datasource control, then attribute would be like
Mind, this can be done only post Update 22.
Thanks!!! See you on next post......
Its much easier than you think, only drawback is you don't really have a power of intellisense on this.
But, who cares as long as it works.
Scenario:
Form: SalesTable
Datasource: SalesTableExt (Custom table)
Task: to fillup value in field salestable (recId of salesTable data) on datasource write method.
////// extension class for SalesTableExt on form SalesTable /// [ExtensionOf(formdataSourceStr(SalesTable, SalesTableExt))] final class SalesTablefdsSalesTableExtTest_Extension { ////// write method on datasource /// void write() { this.writePre(); next write(); } ////// prewrite method /// protected void writePre() { this.resolveSalesId(); } ////// salesId(recid) update in SalesTableExt /// protected void resolveSalesId() { FormDataSource ds = this; SalesTable salesTable = ds.formRun().dataSource(formdataSourceStr(SalesTable, SalesTable)).cursor(); SalesTableExt salesTableExt = ds.cursor(); salesTableExt.SalesTable = salesTable.RecId; } }
Attribute
[ExtensionOf(formdataSourceStr(SalesTable, SalesTableExt))]defines the object where COC has to be performed.
In a similar way, we can use Coc on form controls. Only difference would be there on attribute for class, it would be like
[ExtensionOf(formControlStr(SalesTable, SalesTableExt_SalesTable))]
and if needed on form datasource control, then attribute would be like
[ExtensionOf(formDatasourceControlStr(SalesTable, SalesTableExt, SalesTable))]
Mind, this can be done only post Update 22.
Thanks!!! See you on next post......
Wow! this is Amazing! Do you know your hidden name meaning ? Click here to find your hidden name meaning
ReplyDeleteThank you for sharing wonderful information.
ReplyDeleteDevOps Training
DevOps Online Training
very useful post..
ReplyDeleteMicrosoft dynamics 365 for finance and operations
Dynamics 365 finance and operations
D365 finance and operations
Dynamics 365 training
Microsoft dynamics 365 training