- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 05:23 AM
Hi Experts.
I've launch my Client Script in production, but suddenly it something went wrong.
UI Type: All
Isolate script: True
onChange script:
Script returns response and alert() also working, but g_form.setDisplay() only does not work.
*It works in Platform UI
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var ga = new GlideAjax('GetChoiceValueInCSM');
ga.addParam('sysparm_name', 'getChoiceByDependentValue');
ga.addParam('sysparm_element', 'u_third_category');
ga.addParam('sysparm_dependentvalue', g_form.getValue('subcategory'));
ga.addParam('sysparm_tablename', 'sn_customerservice_case');
ga.getXMLAnswer(getChoices);
function getChoices(response) {
if (response) {
g_form.setDisplay('u_third_category', true);
alert("!!");
} else {
g_form.setDisplay('u_third_category', false);
alert("!!22");
}
}
}
I can't even guess the cause. How can I fix it?
Regards.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 08:29 PM
Dear Respondents
The cause of this issue has been identified.
The problem wasn't the script. The cause was that the Workspace View Rule did not show the field.
Thank you for your cooperation.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 08:04 AM
Hello,
I have read about Client script not working properly when using dependent values specially when adding/removing choices but your case seems to be different but can you try with setVisible instead of setDisplay.? Also add alert above set function.
Regards
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 06:48 PM
Hi,
I've tried setVisible instead, but it does not work also.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-30-2022 08:29 PM
Dear Respondents
The cause of this issue has been identified.
The problem wasn't the script. The cause was that the Workspace View Rule did not show the field.
Thank you for your cooperation.