- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 02:14 AM
Hi All,
We have change table in that we have two fields ."ci "is reference field(cmdb_ci) and "type" is string with four values(standard,comprehensive,stable and delay)
,now we have a requirement that when ever type of ci is corporate then only then only in the "type "field we need to get the option "stable"other wise "type"field should populate only three dropdown values.
Warm Regards
Govardhan
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 04:22 AM
Hi,
Go to UI policy and select
condition: configuration item is corporate
in advance mode
run script this
if true
g_form.setValue('your field name','stable);
g_form.removeOption('your_field_name, 'value of standard');//add choices as per requirement
g_form.removeOption('your_field_name, 'value of ,comprehensive' )
g_form.removeOption('your_field_name, 'value of delay')
if false
g_form.removeOption('your_field_name','value of stable');
value of choice get by right click on choice and click on Show Choice list.
Mark as: LIKE/Correct/Helpful
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 02:31 AM
Hi,
You can write onChange/onLoad client script and make use of removeOption method as explained in the below link:
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#removeOption
Regards,
Prajakta
PS - Hit Like, Helpful or Correct Answer, if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 02:36 AM
i am new to java script ,and what i have tried hasn't worked can i have the code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 02:44 AM
Hi,
Create an OnChange client script and give the field name as your ci field name. Write the below code:
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue != 'corporate'){
g_form.removeOption('field_name_for_type', 'value of stable');
}
}
Write the same code in onLoad CS as well.
Let me know, if this helps.
Regards,
Prajakta
PS - Hit Like, Helpful or Correct Answer, if applicable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-16-2016 03:20 AM
Hi thank you for the reply ,
but my requirement is ,when ever "ci" is corporate then only i have see the value stable in the "type"field other wise i should not see