- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 02-12-2022 02:41 PM
I have seen this a few times in the community and wanted to do a quick post about hiding form sections by UI policy. In my case, I am going to be hiding based on my amazon connect business services.
Form sections are a little different than regular fields. They have an underlying value like any field on the form but they aren't the same. If you have a form field called "This Is a Form" you would expect the value you to be "this_is_a_form". Sections, on the other hand, go like this: Your section name is "This is a section" but the underlying value will be "this_isasection". notice the structure, The first space uses an "_" but any space following is just removed. You are unable to change the underlying value to be more friendly.
go to the form designer and add your new sections. In my case, I have a couple of additional sections. I have added the incident variable editor to my incident form so I needed to do an extra step. First, I needed to find out the order my Self Service Input section was sitting. To do this, open up your console and type in g_form.getSectionNames(); You can see on my incident form I have 9 sections in total and self-service is sitting in 5.
Then you need to open up UI policies and find FormSection_Ctrl_self_service and edit the line 5 - sections[5].style.display = 'block'; Change the number to wherever your self-service section is sitting. Do that for both the true and false conditions.
To hide your sections is pretty simple. create your UI Policy and make sure to check run Scripts. In your true/false sections add your code:
True:
function onCondition() {
g_form.setSectionDisplay('microphone', true);
g_form.setSectionDisplay('call_quality', true);
}
False:
function onCondition() {
g_form.setSectionDisplay('microphone', false);
g_form.setSectionDisplay('call_quality', false);
}
- 22,349 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @DanielCordick,
I hope you are well and thanks for the great explanation, I am new to scripting in SNOW and have a interesting use case for your expertise. a Change Management team run post implementation reviews on changes that cause incident(s). please keep in mind im doing all of this in a PDI.
what we have is:
a "failed change review" section on the change_request form with custom fields and related lists (screenshot below)
what is needed is:
when the "caused by change" field on the INCIDENT form is initially set or updated, look up field and show the "failed change review" section on the corresponding change_request form and if the caused by change field is empty then dont show "failed change review" tab on change request form
Example:
ie. if CHG0000030 caused 3 incidents the show the "failed change review" section on the change_request form if not then hide it.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I've been studying recently and when checking, it would be easier to use the function g_form.setSectionDisplay('name_section',false).