- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2021 01:08 PM
Below is a screenshot of an onChange script where I am attempting to set the value of a Select Box type variable based on value selected in a Multiple Choice type variable.
Desiring the below:
1) When osc_node_res_action (Multiple Choice type) value is 'new'
osc_node_res_magnetic_flag (Select Box type) should be set to 'Yes'
2) When osc_node_res_action (Multiple Choice type) value is 'modify'
osc_node_res_magnetic_flag (Select Box type) should be set to 'No Change'
I tried using the setValue method first but that had no effect. Then I tried the addOption method which works on the catalog form. But after item submission if I simply refresh the RITM form, there is an alert indicating
"Changes you made may not be saved" with choices to Leave or Cancel.
Also, the value of osc_node_res_magnetic_flag (Select Box type) in the RITM's Variable tab does not change as desired.
NOTE: I have experimented with unchecking the "Applies on Requested Items" and "Applies on Catalog tasks" checkboxes and still the above two behaviors are the same
Or is there any other way I can effect the desired value changes?
Thanks!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2021 09:14 AM
Well, found out that the issue was due to a conflict of the onChange script with a UI Policy on the same field. Now, am setting the value using the Script field in the UI Policy itself instead of in the onClient script and that works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2021 01:24 PM
are the values for Yes and No correct ? i mean lower case or upper case ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2021 07:26 AM
Yes, the casing is correct. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2021 09:55 PM
Hi @dp
Try below code, it should work
if (isLoading || newValue == 'new') {
g_form.setValue('osc_node_res_magnetic_flag', 'yes');
return;
}
else if (isLoading || newValue == 'modify') {
g_form.setValue('osc_node_res_magnetic_flag', 'no change');
}
Please mark my answer correct/helpful, if it resolved your issue
Regards,
Harika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2021 07:27 AM
Thanks for your reply. That code doesn't work. There is no effect upon selecting 'modify' for osc_node_res_action