- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 12-13-2018 06:51 PM
Do you have requirement to hide a form section based on some conditions? And the function setSectionDisplay()is not working. You landed to a right place.
You have section name having few words and have requirement to show/hide this section based on some conditions.
setSectionDisplay() - This function is available for client side scripting and is used to show or hide a form section.
Understand this with below example:
Lets say section name is "High Priority Justification"
First I have written below code to hide this section
g_form.setSectionDisplay('High Priority Justification'); // This didn't work
Then all the uppercase letter are replaced with small case
g_form.setSectionDisplay('high priority justification'); // Still this is not working.
Then all the space is replaced with underscore and I thought this time this should work
g_form.setSectionDisplay('high_priority_justification'); // Still this is not working.
Then I found in the ServiceNow bible(ServiceNow developer site) ,replace the first space char with underscore and remove the subsequent space. So I put the code as below .
g_form.setSectionDisplay('high_priorityjustification');
And, Some magic happened this time and this worked.
Isn't this behavior crazy? Question arises in my curious mind is why servicenow platform developers has not setup this function by replacing all the space with underscore or remove all the in between space instead of replacing first space with underscore and removing others?
You can find details on below link.
- 745 Views