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. 

 

17 REPLIES 17

Ankur Bawiskar
Tera Patron
Tera Patron

@Shantharao 

Hope you are doing good.

Let me know if I have answered your question.

If so, please mark appropriate answer as correct & helpful to close the thread.

Regards
Ankur

 

Regards,
Ankur
Certified Technical Architect  ||  9x 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();