- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2021 05:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2021 07:53 AM
Deepak's suggestion to use a dependent field is definitely the best option, if you have issues a second option could be a client script using g_form.getValue('field') and using an if statement with g_form.addOption('city', 'option value') or g_form.removeOption('city', 'option value') within.
Below is an example of an onload client script i recently used to remove an option on a specific change type, for some reason dependent values were not working in this case (have used them elsewhere so not sure why this was different).
function onLoad() {
//Type appropriate comment here, and begin script below
var type = g_form.getValue('type');
var impact = g_form.getValue('u_moc_level_of_impact');
if (impact == 'critical' && type != 'moc_global') {
g_form.addErrorMessage('Level of impact can no longer be critical on Non-Global MOC records. Impact has been changed to Major on this MOC.');
g_form.setValue('u_moc_level_of_impact', 'major');
g_form.removeOption('u_moc_level_of_impact', 'critical');
} if(type != 'moc_global'){
g_form.removeOption('u_moc_level_of_impact', 'critical');
}
}
Thanks,
Dan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2021 06:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2021 07:53 AM
Deepak's suggestion to use a dependent field is definitely the best option, if you have issues a second option could be a client script using g_form.getValue('field') and using an if statement with g_form.addOption('city', 'option value') or g_form.removeOption('city', 'option value') within.
Below is an example of an onload client script i recently used to remove an option on a specific change type, for some reason dependent values were not working in this case (have used them elsewhere so not sure why this was different).
function onLoad() {
//Type appropriate comment here, and begin script below
var type = g_form.getValue('type');
var impact = g_form.getValue('u_moc_level_of_impact');
if (impact == 'critical' && type != 'moc_global') {
g_form.addErrorMessage('Level of impact can no longer be critical on Non-Global MOC records. Impact has been changed to Major on this MOC.');
g_form.setValue('u_moc_level_of_impact', 'major');
g_form.removeOption('u_moc_level_of_impact', 'critical');
} if(type != 'moc_global'){
g_form.removeOption('u_moc_level_of_impact', 'critical');
}
}
Thanks,
Dan