Report on time between change 'Review' state and 'Planned Start'

ebaileyybs
Tera Expert

Hi,

 

We are looking to create a report for Change Management which will show the time between a change moving to 'Review' state and the 'Planned Start' date of the change record.

 

We would like the time to be calculated for every change, so the information can then be exported and we can work out an average. However if there is a way to obtain the time between Review and Planned Start for each record and an average then that would be great.

 

Please let me know if further information is required.

 

Thanks in anticipation,

 

Emma

1 ACCEPTED SOLUTION

Hi Emma,



Lets keep things simple and get this done



Business rule script



var planned_start_date = gs.now()


var daysDuration = gs.dateDiff(current.start_date,gs.now());


current.u_lead_time =daysDuration;




/*I have tried this on demo and its works just fine(provided you planned start date has a value, you can add checks).*/




And Lead Time field is 'duration'








You can see the same if you log on to


https://demochannel.service-now.com




Create any change request


-Anurag

View solution in original post

15 REPLIES 15

Thank you for your reply and help so far.



I have amended the field to a duration type and I have amended the script as per the above update, however, unfortunately this still does not work.



Is there anything else I need to change to make this work?



Kind regards,


Emma


Emma, do only one of the above, not both


lets keep the u_lead_time as string only.


and add the below line to code...


current.u_lead_time =daysDuration.toString() ;


-Anurag

Ok, so I have changed 'u_lead_time' back to string and used current.u_lead_time =daysDuration.toString() ; - this does not work




I have also tried a duration field on 'u_lead_time' with current.u_lead_time =daysDuration ; - this does not work




Apologies, is there anything else I can try to resolve this?




Kind regards,


Emma


Hi Emma,



Lets keep things simple and get this done



Business rule script



var planned_start_date = gs.now()


var daysDuration = gs.dateDiff(current.start_date,gs.now());


current.u_lead_time =daysDuration;




/*I have tried this on demo and its works just fine(provided you planned start date has a value, you can add checks).*/




And Lead Time field is 'duration'








You can see the same if you log on to


https://demochannel.service-now.com




Create any change request


-Anurag

Thank you very much! The script has worked