- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2014 08:36 AM
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
Solved! Go to Solution.
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 07:36 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 06:42 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 06:46 AM
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() ;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 07:00 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 07:36 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2014 07:47 AM
Thank you very much! The script has worked