How to hide process flow stages based on specific field conditions on the table?

Shantharao
Kilo Sage

Hello All,

 

I have a process flow formatter as below,

I have a true/false checkbox field on the form based on this field I have to hide/show two more stages on to this table formatter in between the existing stages, is it possible? 

find_real_file.png

 

Thanks in advance for the response. 

 

9 REPLIES 9

Not applicable

Thanks for the modification Ankur, got this working based on your script.

However $$ wasn't working for me so I had to change it to 

$j("a:contains('Initial/Draft')").hide();

After setting the ui policy to non isolate.

Thanks!

I tried the same way as above but its not working at all !! 

 

want to hide 3 of the process flow formatter based on status values.

Ankur Bawiskar
Tera Patron

Hi Shantharo,

Let me know if that answered your question.

If so, Please consider marking appropriate reply as ✅Correct & 👍Helpful.

Regards
Ankur

 

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

undefined1
Tera Contributor

I tried the solution like:

function onCondition() {
  $$('.disabled')[4].hide();
  $$('.disabled')[5].hide();
}

issue is that as you move through phases the index of the phases changes based on current active phase. example in change management:

on phase New => Assess is index1, Authorize is index2, Scheduled is index3...

on phase Assess => Assess is active, Authorize is index1, Scheduled is index2...

on phase Authorize => Assess is index1, Authorize is active, Scheduled is index2...

and so on.

 

My customer decided to use new type of change and I had to get rid of some default phases, so I created UI Policy with isolate script false and condition: if type is my new change type then run this script in execute if true:

function onCondition() {

    var phasesToHide = ["Assess", "Authorize", "Scheduled", "Implement", "Review"];
    var disabledElements = document.querySelectorAll('.disabled');

    disabledElements.forEach(function(element) {
        phasesToHide.forEach(function(phase) {
            if (element.textContent.includes(phase)) {
                element.style.display = 'none';
            }
        });
    });
}
}

and this worked. I also created similar script, with condition if type is standard, normal or emergency then ignore phases from my new change type. i know this could be done in execute if false but I'm not sure how many other change types customer will think of.

 

 

Geeethanjali
Tera Contributor
The below one worked well for me.
$j(
"a:contains('Review')").parent().hide();