- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 12:18 AM
Hi Team,
I want to remove the 'Awaiting Acceptance' option from the state for the Anonymous report in HRSD. I tried creating an onLoad Client Script, but it's not working properly. Please let me know the steps and script for removing 'Awaiting Acceptance' for the Anonymous report.
Thankyou
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 02:11 AM
or you can use sysId of that hr service
function onLoad() {
// Get the HR Service value
var hrService = g_form.getValue('hr_service');
// Check if the HR Service is "Anonymous Reports"
if (hrService == 'sysIdHRService') {
// Hide the state field
g_form.removeOption('state', 20);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 02:11 AM
or you can use sysId of that hr service
function onLoad() {
// Get the HR Service value
var hrService = g_form.getValue('hr_service');
// Check if the HR Service is "Anonymous Reports"
if (hrService == 'sysIdHRService') {
// Hide the state field
g_form.removeOption('state', 20);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 04:26 AM
Hi Ankur,
Thanks for your quick response, but the above script is not working as excepted
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 05:06 AM
why your client script is in global scope?
the table is not from global scope
Did you check it's going inside the IF statement for comparison of sysId?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2025 11:50 AM
Alternative, UI Policy with the 'On Load' checkmark can be created instead of OnLoad Client Script where the condition is
'HR Service' 'is' 'Anonymous Reports'
Then in the script field
g_form.removeOption('state', 20)