display number of open Change Tasks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 01:28 PM
Hi,
I would like to display a number on the change form which shows the number of open change tasks for that change.
The field will be a String called Open Tasks.
Does anyone know how to do this or has a script which would display this on the Change form?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2020 05:19 PM
Blog: https://sys.properties | Telegram: https://t.me/sys_properties | LinkedIn: https://www.linkedin.com/in/slava-savitsky/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2020 06:43 AM
Yes, that is true

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2020 11:52 AM
Yes Slava has a correct point, So in that scenario we can add After Insert/Update Business rule on change_task table which will update the change_request field whenever a new change_task is added or closed.
Please find the Script Below:
(function executeRule(current, previous /*null when async*/) {
var gr= new GlideRecord('change_task');
gr.addActiveQuery();//query only active change task
gr.addQuery('change_request',current.change_request);//query change task with same parent change request
gr.query();
updatecount(gr);
})(current, previous);
function updatecount(gr){
var gr2 = new GlideRecord('change_request');
gr2.get(current.change_request);//get the parent change request
if(gr2.isValidRecord()){
if(gr2.field_name.toString()!=gr.getRowCount()){//validates if the active count is not same
gr2.field_name=gr.getRowCount();//sets the row count in change request
gr2.update();
}
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2020 12:50 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2020 06:43 AM
Hi Alok,
That is a good question. We have some Standard changes with a lot of tasks, having a field to show the number would allow easy identification of how many are open, set up triggers and alerts and allows a number to be visible in a List.