- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 11:20 PM
Hi All,
Below is my requirement,
i have a request to close RITM's related to particular service.
In that service i have a field like date. if user selected the date last 4days i didn't choose those RITM's.
My request is in every RITM i have tasks more than 5. If at least 1 task is closed incomplete in that case i need to update RITM state as Closed incomplete. same like all tasks complete i need to update RITM state as Completed.
Can any one provide guidance on this?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2022 12:29 AM
You can write fix script as below.
var gr = new GlideRecord('sc_req_item');
gr.addEncodedQuery("");// give the encoded query here for your RITMs
gr.query();
while (gr.next()) {
var comp_count = 0;
var incomp_count = 0;
var sc = new GlideRecord('sc_task');
sc.addQuery('request_item', gr.sys_id);
sc.query();
var count = sc.getRowCount();
while(sc.next())
{
if(sc.state == '4') //give backend value of closed incomplete in sc task
{
incomp_count += 1;
}
else if(sc.state == '3') //give backend value of closed complete in sc task
{
comp_count += 1;
}
}
if(incomp_count > 0)
{
gr.state = '4'; //give backend value of closed incomplete in RITM
gr.update();
}
if(comp_count == count)
{
gr.state = '3'; //give backend value of closed complete in RITM
gr.update();
}
}
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 11:24 PM
Do you have a flow attached? Is this done via Workflow? In either of these cases you can add your functionality in those.
If not: create a BR to update the RITM on the trigger of closing a case (if 1 is closed incomplete, you may also want to close the other, still open tasks as 'incomplete').
If my answer helped you in any way, please then mark it as helpful.
Mark
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 11:40 PM
i need to write a fixscript for this

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 11:25 PM
Hi,
Your requirement is not clear.
Can you explain this clearly "In that service i have a field like date. if user selected the date last 4days i didn't choose those RITM's.".
And also is it to be done for existing records via fix script or to be done for upcoming records?
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2022 11:51 PM
Hi Sumanth,
you can leave that I need to write a fix script to update RITM state close/ close incomplete based on tasks state.
at least 1 task state is closed incomplete i need to update RITM state as closed incomplete.
all task states is closed i need to update RITM state as complete