X++ code using getDateAdd of SysComputedColumn in D365FO
Hi,
In this post will provide the code to show the usage of getDateAdd method of SysComputedColumn in D365FO. In general, it's used to add offset to the given date. For demo purpose, we will view the date prior 30 days 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 computePrior30Days(namely) on entity DAXCustHistoryTransEntity.
Step 2: In this method, used getDateAdd method of SysComputedColumn to calculate 30 days prior date to the due date of data entity DAXCustHistoryTransEntity.
//
Step 3: Created a new field Prior30Days on entity DAXCustHistoryTransEntity and assigned the method computePrior30Days to it.
On firing the OData call to the entity, received the below output with column Prior30Days showing the date that is 30 days prior to due date.
Thanks,
Chaitanya Golla
*This post is locked for comments