- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2017 04:53 PM
Hi Developers,
I have written the below script to hide a section with the following code:
function onLoad() {
var sections = g_form.getSectionNames();
if (g_user.isMemberOf('CAB Approval')){
g_form.setSectionDisplay('related_records',true);
}else{
g_form.setSectionDisplay('related_records',false);
}
}
Turns out this script doesn't get executed. Can i know the reason why? when i used g_user.hasRole('inc_viewer'); it worked.
Let me know if i am missing something here...
Thanks,
pK.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2018 04:57 PM
Hi Shloke,
I tried this but didn't work, I did a small tuning because I created a form section called "Employee Location" that I want to hide from a group "HR On Boarding". This is the script I used (I did the display BR as you suggested and called it on the script):
function onLoad() {
var sections = g_form.getSectionNames();
if (g_scratchpad.grp == 'true')
{
g_form.setSectionDisplay('Employee Location',false);
}
else{
g_form.setSectionDisplay('Employee Location',true);
}
}
Please let me know your thoughts.
Regards Danny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2018 04:57 PM
Hi Shloke,
I tried this but didn't work, I did a small tuning because I created a form section called "Employee Location" that I want to hide from a group "HR On Boarding". This is the script I used (I did the display BR as you suggested and called it on the script):
function onLoad() {
var sections = g_form.getSectionNames();
if (g_scratchpad.grp == 'true')
{
g_form.setSectionDisplay('Employee Location',false);
}
else{
g_form.setSectionDisplay('Employee Location',true);
}
}
Please let me know your thoughts.
Regards Danny

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-25-2018 07:16 AM
Hi
Section name should be in lower case.
eg: if section name is "Hello world" then it should be hello_world.
The section name is lower case with an underscore replacing the first space in the name, and with the remaining spaces being removed, for example "Section Four is Here" becomes "section_fourishere". Other non-alphanumeric characters, such as ampersand (&), are removed. Section names can be found by using the getSectionNames() method.
Please refer the link below.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2018 02:59 PM
Hi,
As suggested below by Harsh, kindly give the section name as lower case as mentioned below:
g_form.setSectionDisplay('employee_location',false);
This should work for you.
Cheers,
Shloke
Regards,
Shloke