X++ code using SysComputedColumn to use SysColumnDatePart(Year) in D365FO
Hi,
In this post will provide the code to show the usage of SysColumnDatePart(Year) of SysComputedColumn in D365FO. For demo purpose, we will view the date with prior year to the due date.
Setup: Please refer this post to know the details of views DAXCustHistoryInvoices, DAXCustHistoryPayments and data entity DAXCustHistoryTransEntity.
X++ code using SysComputedColumn with an if loop in D365FO - Dynamics 365 Finance Community
Step 1: Created a new method computePriorYear(namely) on entity DAXCustHistoryTransEntity.
Step 2: In this method, used getDateAdd method of SysComputedColumn to calculate date with prior year when compared to due date of data entity DAXCustHistoryTransEntity.
Step 3: Created a new field PriorYear on entity DAXCustHistoryTransEntity and assigned the method computePriorYear to it.
On firing the OData call to the entity, received the below output with column PriorYear showing the date that with year prior to due date.
Thanks,
Chaitanya Golla

Like
Report
*This post is locked for comments