I am trying to design a standard HR assistant which will give user an option to apply leaves. Now for this I have Date Period Entity but I am not sure how to validate this.
Need to validate that From Date should be greater than the present date.
Need to validate that To Date should be greater than the From Date.
You need to define a script node to validate the From Date to Present date. Capture the date entered by user and then validate to present date using Script Node.
I followed the same but I am not able to write script for date period entity.
Hence I modified the designer flow and added two separate date entities for from date and to date and then added a script node to validate the difference as below snap:
However now I want to calculate the difference between these dates so that I can update balance and post it to a mock API.
But I am unable to do so.
Even I applied javascript function as below but it doesn’t work:
Ideally I wanted to store the balance and post it to Mock API so that leaves can be updated.
My Mock API looks like this
I followed the same but I am not able to write script for date period entity.
Hence I modified the designer flow and added two separate date entities for from date and to date and then added a script node to validate the difference as below snap:
This works fine now
However now I want to calculate the difference between these dates so that I can update balance and post it to a mock API.
But I am unable to do so.
Even I applied javascript function as below but it doesn’t work:
Ideally I wanted to store the balance and post it to Mock API so that leaves can be updated.
My Mock API looks like this
The date period entity returns a JSON object where the from and to dates are separate values and so they can be referenced in JS: context.entities.entityName.fromDate and context.entities.entityName.toDate
Ordinarily the platform will return the earliest date in fromDate and the latest date in toDate, so you don’t have to perform that check anyway.