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-20-2020 12:20 PM
Hey Riaz,
You can achieve this by using After Business Rule and write script as below. It shows the number of open change tasks for that change.
var a= new GlideRecord('change_task');
a.addQuery("change_request",current.sys_id);
a.addQuery("state",1);
a.query();
var b=a.getRowCount();
gs.addInfoMessage("Count:" +b);//here you have to setValue to your open task string field.
Please mark correct and helpful if it works for you.
Regards,
Indrajit.