- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 11:09 AM
I am currently using a display business rule and a client script to hide 3 fields on a form. The issue is, when the form loads, these fields are visible for a few seconds and then just disappear, leave blank space on the form.
While this works, I was wondering if there was a better way to do this so the blank space that is taken up by these fields disappears as well. I'd rather the fields below these ones move up to fill the space instead of leaving a large blank space on the form.
Also, is there a different way to do this that will prevent the fields from showing up for the fraction of a second they appear for before the business rule runs?
The part in the red rectangle is what I'd like to fill with the fields under it.
Current code to hide the fields:
Display BR:
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.isMember = gs.getUser().isMemberOf('HR Payroll');
})(current, previous);
Client Script:
function onLoad(){
if(g_scratchpad.isMember.toString() == 'false'){
// hide your fields one by one
g_form.setVisible('u_run_type', false); // your field name here
g_form.setVisible('u_year', false); // your field name here
g_form.setVisible('u_pay_period', false); // your field name here
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 11:12 AM
Hi,
Please use:
setDisplay instead of setVisible.
As far as timing is concerned, that is all dependent on the client and the form loading process.
You may want to review all of your client scripts, etc. and see if there's a way to streamline the process or consider setting this specific client script to a lower order number so it executes first.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 11:12 AM
Hi,
Please use:
setDisplay instead of setVisible.
As far as timing is concerned, that is all dependent on the client and the form loading process.
You may want to review all of your client scripts, etc. and see if there's a way to streamline the process or consider setting this specific client script to a lower order number so it executes first.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 11:16 AM
That was simple, thanks! You don't happen to know a better way to do this that might prevent the fields from showing up for about a second before the business rule runs do you?
Also, I've tried a few different ways and can't seem to figure it out, how would I go about changing my Business Rule to check for multiple group memberships instead of just the one?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2022 11:23 AM
Hi,
I wrote a bit more above (in an edit) about the timing issue. Please review that.
As far as adjusting your business rule script, you could do (there's a few ways to do it, but one is):
if (gs.getUser().isMemberOf('HR Payroll') > -1 || gs.getUser().isMemberOf('Group 2') > -1 || gs.getUser().isMemberOf('Group 3') > -1) {
g_scratchpad.isMember = true;
} else {
g_scratchpad.isMember = false;
}
Please mark reply as Helpful, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!