- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 11:23 PM
Hi All,
I have a table called 'Allegation Outcomes' in which there is a dot walked field called Allegation type.
An onchange client script needs to be configured on this field and on change of this field options have to be added and removed in the outcome field.
Issue: unable to configure the onchange 'Field name' for dot walked field.
Can anybody suggest an alternative or any other solution to achieve the results?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 12:19 AM
it won't work that way for dot walked field.
Why are you allowing to change the Allegation type dot walked field on your current form?
If it has to be updated then it should be updated in the actual record and not on the form where it's shown as dot walked field
For your requirement you can use onLoad client script to check the value and then hide
function onLoad() {
if (g_form.getValue('allegation.allegation_type') == 'your value') {
g_form.removeOption('outcome', 'choice value');
}
}
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
05-13-2025 11:44 PM
Hi @sanvi,
- Create an onChange Client script with any other field
- Open the Client script list view, filter on that client script
- Add column “Field name”
- Replace the Field name value with the dot walk field like: “table.field_name”
Note: dot walked field needs to be on the form
Original answer is provided by Mate Levai from this QA: https://www.servicenow.com/community/itsm-forum/onchange-client-script-for-changing-dot-walk-field/t...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 11:57 PM
Hi @phgdet ,
I tried the above steps. but once i update the field name from list view and once i update the script and save it the field name becomes empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 12:11 AM
hi @sanvi,
So that you need to update <field name> on the list once again after modify your code.
Or you can run a background script every time you modified your code.
var current = new GlideRecord("sys_script_client");
if (current.get("<your_client_script_id>")){
current.setValue("field", "table.field_name"); //type your dot walked field here
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2025 12:59 AM
Hi @phgdet ,
I feel this as risk. What if by miss the code stops working in PROD??
Is there any other way that this can be achieved?