Difference of two date/time type fields should populate in Duration type field

RC19
Tera Contributor

We have two date/time type fields and the requirement is to capture the difference of these date/time fields into a duration type field . I have written business rule and i am getting subtraction value in seconds or days 00:00:00 format using script but if i set that value to duration type field then it is not working . Sometimes i am getting some 1970-01-01 date with the difference value added to that date. Please advise.

1 ACCEPTED SOLUTION

@RC Since I have used calculated value it is read-only be dafault you can use the same script in a before business rule as well. You just have to change the last line. 

 

instead of return dur ; use below line

current.<duration_field_name> = dur;

View solution in original post

5 REPLIES 5

RC19
Tera Contributor

Thanks Suvro