Active field in requested item is not changing to false , When state is closed complete .

nameisnani
Mega Sage

Hi All ,

 

I am facing the below issue in my ServiceNow instance wherein the status of the field Active of the RITM's  sometimes are not changing to false when the state is 'Closed completed'  because of which the RITM's are showing up in service portal widget' My request' Closed Complete' option . 


Any suggestions on this/ or anyone has faced similar issue.


I feel writing a business rule on RITM table will work , however wanted to understand why its happening when for the same catalog item.

 

can anyone please root cause for this . 

 

SunilKumarPadh_0-1690961918014.png

SunilKumarPadh_1-1690961927305.png

 

 

@ServiceNow10sun 

 

3 ACCEPTED SOLUTIONS

BharathChintala
Mega Sage

@SunilKumar Padh  can you check any catalog tasks are open under those req items??

and also no need to write business rule there is already one oob provided for this.

If my inputs have helped with your question, please mark my answer as accepted solution, and give a thumb up.
Bharath Chintala

View solution in original post

nameisnani
Mega Sage

HI @Harshal Aditya  & @BharathChintala 

 

Thanks for the reply .

 

where i need to update in OOB business rule .

could you please suggest here .

 

SunilKumarPadh_0-1690967781989.png

 

condition - 

current.stage.changes() && (current.stage=="complete" || current.stage=="Request Cancelled" || current.stage=="closed_incomplete" || current.stage=="closed_skipped")

Script - 

(function executeRule(current, previous /*null when async*/ ) {
    current.active = false;
    // Delivery Plan Specific, update the state here, so that TaskStateUtil, won't be able set the state.
    if (!current.delivery_plan.nil()) {
        if (current.stage == 'closed_incomplete' || current.stage == 'Request Cancelled')
            current.state = 4;
        else if (current.stage == 'closed_skipped')
            current.state = 7;
    }

    // If we started a workflow for this item, cancel it
    if ((current.stage == 'Request Cancelled') && current.context && !current.context.nil()) {
        var w = new Workflow();
        var gr = new GlideRecord('wf_context');

        if (gr.get(current.context))
            w.cancelContext(gr);
    }

})(current, previous);

 

can anyone please provide me the updated script . 

 

Thanks in Adavance

 

@Ravi Chandra_K 

View solution in original post

make the OOB inactive and create similar BR with Modified Advanced Conditions.

Or else Modify the Workflow being used by your Request Item so that the Stage is set to one of the expected values. (E.g. complete, Request Cancelled, closed_incomplete or closed_skipped)

Please hit the thumb and Mark as correct if it helped!

Kind Regards,

Ravi Chandra

View solution in original post

10 REPLIES 10

ritu_saluja
Tera Expert

Hello @nameisnani ,

Did you set the active field to false in workflow by using "set values" activity when the state is closed complete

@ritu_saluja 

 

There are some 50+ catalogue are there, it's really very tough to see and update all , instead of doing this can u provide me the BR

@nameisnani 

can you please read the following article and make the changes accordingly

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0957617

 

Ankur Bawiskar
Tera Patron
Tera Patron

@nameisnani 

Is this happening only for particular catalog item's RITM or for all RITMs?

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Yes , it is happening randomly. @Ankur Bawiskar