- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 02:12 AM - edited 04-17-2023 02:29 AM
Dear Team,
I am facing an issue, I have an Onchange catalog client script (UI Type-All; Applies to the requested item and catalog task-True) on a Variable 'System Access' of type 'Select Box' that have more than 10 choices, I wrote below the client script
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
if (newValue == '') {
g_form.setDisplay('accessA', false);
g_form.setDisplay('accessB', false);
g_form.setDisplay('accessC', false);
g_form.setDisplay('accessD', false);
g_form.setDisplay('accessE', false);
g_form.setDisplay('accessF', false);
g_form.setDisplay('accessG', false);
} else
return;
}
var SAcss = g_form.getValue('system_access');
if (SAcss == 'ValueofChoice1') {
g_form.setDisplay('accessA', true);
g_form.setDisplay('accessB', true);
g_form.setMandatory('accessC', false);
g_form.setDisplay('accessC', false);
g_form.setMandatory('accessD', false);
g_form.setDisplay('accessD', false);
g_form.setMandatory('accessE', false);
g_form.setDisplay('accessE', false);
g_form.setMandatory('accessF', false);
g_form.setDisplay('accessF', false);
g_form.setMandatory('accessG', false);
g_form.setDisplay('accessG', false);
} else if (SAcss == 'ValueofChoice2') {
g_form.setDisplay('accessA', true);
g_form.setDisplay('accessB', false);
g_form.setMandatory('accessC', false);
g_form.setDisplay('accessC', false);
g_form.setMandatory('accessD', false);
g_form.setDisplay('accessD', false);
g_form.setMandatory('accessE', false);
g_form.setDisplay('accessE', false);
g_form.setMandatory('accessF', false);
g_form.setDisplay('accessF', false);
g_form.setMandatory('accessG', false);
g_form.setDisplay('accessG', false);
} else if (SAcss == 'ValueofChoice3') {
g_form.setDisplay('accessA', false);
g_form.setDisplay('accessB', false);
g_form.setMandatory('accessC', true);
g_form.setDisplay('accessC', true);
g_form.setMandatory('accessD', false);
g_form.setDisplay('accessD', false);
g_form.setMandatory('accessE', false);
g_form.setDisplay('accessE', false);
g_form.setMandatory('accessF', false);
g_form.setDisplay('accessF', false);
g_form.setMandatory('accessG', false);
g_form.setDisplay('accessG', false);
} else if (SAcss == 'ValueofChoice4') {
g_form.setDisplay('accessA', false);
g_form.setDisplay('accessB', false);
g_form.setMandatory('accessC', false);
g_form.setDisplay('accessC', false);
g_form.setMandatory('accessD', true);
g_form.setDisplay('accessD', true);
g_form.setMandatory('accessE', false);
g_form.setDisplay('accessE', false);
g_form.setMandatory('accessF', false);
g_form.setDisplay('accessF', false);
g_form.setMandatory('accessG', false);
g_form.setDisplay('accessG', false);
} else if (SAcss == 'ValueofChoice5') {
g_form.setDisplay('accessA', false);
g_form.setDisplay('accessB', false);
g_form.setMandatory('accessC', false);
g_form.setDisplay('accessC', false);
g_form.setMandatory('accessD', false);
g_form.setDisplay('accessD', false);
g_form.setMandatory('accessE', true);
g_form.setDisplay('accessE', true);
g_form.setMandatory('accessF', false);
g_form.setDisplay('accessF', false);
g_form.setMandatory('accessG', false);
g_form.setDisplay('accessG', false);
} else if (SAcss == 'ValueofChoice6') {
g_form.setDisplay('accessA', false);
g_form.setDisplay('accessB', false);
g_form.setMandatory('accessC', false);
g_form.setDisplay('accessC', false);
g_form.setMandatory('accessD', false);
g_form.setDisplay('accessD', false);
g_form.setMandatory('accessE', false);
g_form.setDisplay('accessE', false);
g_form.setMandatory('accessF', true);
g_form.setDisplay('accessF', true);
g_form.setMandatory('accessG', false);
g_form.setDisplay('accessG', false);
} else if (SAcss == 'ValueofChoice7') {
g_form.setDisplay('accessA', false);
g_form.setDisplay('accessB', false);
g_form.setMandatory('accessC', false);
g_form.setDisplay('accessC', false);
g_form.setMandatory('accessD', false);
g_form.setDisplay('accessD', false);
g_form.setMandatory('accessE', false);
g_form.setDisplay('accessE', false);
g_form.setMandatory('accessF', false);
g_form.setDisplay('accessF', false);
g_form.setMandatory('accessG', true);
g_form.setDisplay('accessG', true);
} else if (SAcss == 'ValueofChoice8' || SAcss == 'ValueofChoice9' || SAcss == 'ValueofChoice10' || SAcss == 'ValueofChoice11' ||
SAcss == 'ValueofChoice12' || SAcss == 'ValueofChoice13' || SAcss == 'ValueofChoice14' || SAcss == 'ValueofChoice15' ||
SAcss == 'ValueofChoice16' || SAcss == 'ValueofChoice17') {
g_form.setDisplay('accessA', false);
g_form.setDisplay('accessB', false);
g_form.setDisplay('accessC', false);
g_form.setDisplay('accessD', false);
g_form.setDisplay('accessE', false);
g_form.setDisplay('accessF', false);
g_form.setDisplay('accessG', false);
}
}
This script is working perfectly but the issue I am facing is even though I filled in these details and submitted a request (below is the screenshot of the 'additional details' tab post successful submission of request), the highlighted 2 variables-
Please note this is happening for all other variables as well, but if this gets sorted so will apply same technique to other variables so that it will display on RITM.
Further would also like to inform you that I am unable to get this achieved through UI Policy as well to display the variables on RITM even though that was also applied to RITM and SCTASK.
Can anyone please help me to resolve this, I shall be grateful. Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 03:17 AM
1) Please ensure that variables are the part of catalog item (if it is from variable set, might be a script has written over there).
2) To debug, make all the scripts active false and track the variables on RITM, then make each script active true one by one until you find the culprit.
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 02:37 AM
From the onchange client script , can you make the checkbox "applies on requested item" to false and try again.
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 03:03 AM
Hi @Prince Arora ,
Thanks for your response, per your advise I just tried but same result.
Also I checked other UI policies or Catalog client scripts but found all okay.
Dont know what's wrong here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 03:17 AM
1) Please ensure that variables are the part of catalog item (if it is from variable set, might be a script has written over there).
2) To debug, make all the scripts active false and track the variables on RITM, then make each script active true one by one until you find the culprit.
If my answer solved your issue, please mark my answer as ✅ Correct & 👍Helpful based on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 05:45 AM - edited 04-17-2023 02:34 AM
Thanks @Prince Arora
I tried the way you suggested since saw your message. I am lost with the variables tracking maybe because I need a fresh mind and thus requesting your guidance to resolve this.
Thanks in advance, will mark your resolution as correct and helpful.