- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 04:29 AM
Hi All
I have a small query.
I am writing a onChange client script. my requirement is if "model_category" = "computer" then I need to remove a option from the "substatus" field in the alm_hardware table. model_category is a read-only reference field.
Below is my script.
onChange client script: is not working.
field: State
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 10:55 AM
@Prasnajeet1 , I just checked in my PDI so in your case in alm_hardware the substate is a dependent field on state so i tried onchange of state checked model category the choice value is not getting removed or getting added you can remove dependent value in substate but it will change for every model category.
if it is a dependent value then removeOption will work on onload but not on onchange so you might have to write a combo of both or as workaround if you know on which State choice you want to remove the option write it in onload client script only.
Servicenow
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0681253
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 04:57 AM
Hi @Prasnajeet1 ,
In on change are you getting the alert ?
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 06:07 AM
Hi Swathi
Yes I am getting the alert message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 10:55 AM
@Prasnajeet1 , I just checked in my PDI so in your case in alm_hardware the substate is a dependent field on state so i tried onchange of state checked model category the choice value is not getting removed or getting added you can remove dependent value in substate but it will change for every model category.
if it is a dependent value then removeOption will work on onload but not on onchange so you might have to write a combo of both or as workaround if you know on which State choice you want to remove the option write it in onload client script only.
Servicenow
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0681253
Regards,
Swathi Sarang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2024 10:57 AM
@Prasnajeet1 , If the workaround also doesn't work you might have to raise HI ticket.
Please mark this comment as Correct Answer/Helpful if it helped you.
Regards,
Swathi Sarang