How to hide process flow stages based on specific field conditions on the table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2020 04:36 AM
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?
Thanks in advance for the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2020 02:53 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 03:09 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2024 01:51 PM
$j("a:contains('Review')").parent().hide();