I need to calculate the duration of the state “Pending Review by TL”, which may repeat many times because the “Report Rejected by TL” transition may repeat many times.
Here is the property of the related fields:
I had no problem to calculate the rejection duration every time it happened using the calculation option from the Field Overrides property at the “Report Rejected by TL” transition:
However, when I used the following AppScript to copy the calculated value of the “TL – Report Rejection Duration” field to the other fields like “TL – Report Rejection 1”, “TL – Report Rejection 2” and “TL – Report Rejection 3” etc., the copied fields get a value totally different from their corresponding “TL – Report Rejection Duration” field unfortunately.
In this screenshot, for the first rejection, it took 1 hour and 7 minutes (1:07) for the team lead (TL) to reject the report, but the copy script returned a value as 167 days and 12 hours (167 12:00) instead.
In the following one, for the second rejection, it took 38 minutes (0:38) for the TL to reject the report, but this time the copy script returned a value as 95 days (95 0:00) instead.
For the third rejection, it took 10 minutes (0:10) for the TL to reject the report, but this time the copy script returned a value as 25 days (25 0:00) instead.
I also include the timeline of all transitions related to this report record here as references.
It looks like there was a conversion happened during the “getfieldvalue” of an “elapse time” field that I still cannot figure out nor understand. What did I do wrong with my script or with the property settings? Please help, thanks!