Hide attachment field to one group using business rule and ui policy ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 10:31 PM
Hi All,
I have hide attachment filed using business rule scratchpad and on load client script its working fine , Now my requirement is payment is ACH or wired then bank form has to visible and mandatory in new state only, for with i have written ui policy its working fine.After written ui poilicy scratch pad is not working .
In new state ui policy has to work every user after moving next state bank form has to visible one group and opened by user only. Please help me on this.
Onload client script:
function onLoad() {
var openedBy = g_form.getValue('opened_by');
if ( openedBy == g_user.userID || g_scratchpad.cost ) {
g_form.setMandatory('u_ach_bank_form', true);
g_form.setDisplay('u_ach_bank_form', true);
} else {
g_form.setMandatory('u_ach_bank_form', false);
g_form.setDisplay('u_ach_bank_form', false);
}
}
Ui policy:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 10:42 PM
Hi suresh
So your issue is if you are moving to next state the bank form is still showing?
Modify your client script as below - Always set display first and make the field mandatory.
function onLoad() {
var openedBy = g_form.getValue('opened_by');
if ( openedBy == g_user.userID || g_scratchpad.cost ) {
g_form.setDisplay('u_ach_bank_form', true);
g_form.setMandatory('u_ach_bank_form', true);
} else {
g_form.setMandatory('u_ach_bank_form', false);
g_form.setDisplay('u_ach_bank_form', false);
}
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 10:52 PM
Hi Rohila,
Facing same issue bank has to visible one particular group not to everyone, recently is working fine , i have made changes if payment method is ACH or wired Bank form should be mandatory and visible in new state only . after moving to next bank should not visible to any , only one particular group has access to visible .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 11:02 PM
In your UI policy you should add the filter 'state is new'.
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-16-2022 11:06 PM
I have try that also but its not showing that particular group also.