One field is dependent on two fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2016 06:12 AM
Hi,
I have category and subcategory choice fields on change form.
subcategory field values depends on both type and category choice fields.
Ex:
If category is x and type is normal then subcategory should be p,q
if category is x and type is emergency then subcategory should be y,z
how to achieve two way dependency on subcategory field?
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2016 06:33 AM
Hi Deep K,
I have never worked on this,I will try and get back to you.
Thank You

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2016 06:37 AM
They are not too difficult. Again, see the incident lookup as an example.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2016 06:53 AM
Hi Chuck,
lookup rules sets the value but they doesn't retrieve/populate the subcategory choices based on category and type here.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-29-2016 07:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-26-2017 04:12 PM
I know this is an old post, but if your still working on this I think I understand what you are trying to accomplish.
You want something like if fieldA=valueA AND fieldB=valueB THEN choices available *to choose from* in fieldC are [x, y, z].
I don't think this is supported by adding records in the sys_choice table like you normally would. Instead you would need to script it out in a (i think you need to put it in a client script).
To do this you would use ServiceNow's GlideForm http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#gsc.tab=0
To do something like that it might look like:
if(g_form.getValue('fieldA') == 'valueA' ${AND} g_form.getValue('fieldB') == 'valueB'){
g_form.addOption('fieldC','x','x',1);
g_form.addOption('fieldC','y','y',2);
g_form.addOption('fieldC','z','z',3);
}
Disclaimer: I haven't played with client scripts yet, so I might be wrong. Also, you'll want to think about how to reverse this script if someone changes one of the values in fieldA or fieldB. Likely by calling g_form.removeOption()