How to hide process flow stages based on condition in scoped application?

SairajG
Tera Contributor

Hello,
I have enabled the process flow for my custom application scope. Created the onLoad client script and in script I wrote 

function onLoad() {
    //Type appropriate comment here, and begin script below
    if (g_form.getValue("type") == "query") {
        $j("a:contains('Accepted')").parent().hide();
    }
}

based on type I have to hide some of the stages of the process flow. This script is working in global scope like on incident form. Can anyone suggest me another approach to enable this for scoped table, that would be appreciated.

Thank you in advance.

3 REPLIES 3

Joni V B
Tera Guru

Hi @SairajG ,

 

Are you getting any errors in your browser console?

Maybe this topic can help you forward, it doesn't rely on jQuery to hide the steps:

https://www.servicenow.com/community/developer-forum/hide-process-flow-states-dynamically-just-like-...

 

Best regards,

Joni 

Ankur Bawiskar
Tera Patron
Tera Patron

@SairajG 

you are using DOM manipulation in your script which is not recommended.

Ensure Isolate Script field is False for this client script.

This field is not on form but from list you can set it as False

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Marc Mouries
ServiceNow Employee
ServiceNow Employee

As a note, have you looked into configurable workspace? They provide a much more modern user experience and more flexibility.