- 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 12:25 AM
Can you share your client script, because that's usually the way to go.
Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 02:02 AM
Hi Mark,
Below is onload client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 12:40 AM - edited 12-16-2024 12:41 AM
Hi @SiddharthG55401 ,
function onLoad() {
// Check if the Service field has the value "Anonymous Report"
if (g_form.getValue('hrservice filed backendname') === 'Anonymous Report') {// replace hr service filed backnd name and anonymous report value
g_form.removeOption('state', ‘Awaiting acceptance choice value ');// replace state filed backend name and choice value name
}
}
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-16-2024 02:00 AM
Hi Anand, thanks for your reply, but this script is not working as expected.