- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2017 02:38 PM
Please try with below script with suggested correction and this should help.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var array1 = ['Application issue', 'Network issue', 'Training issue']; // I believe this should be choice value not the choice label
var array2 = ['A','B', 'C'];
if(parseInt(array1.indexOf(current.category.toString())) > -1)
current.u_description = 'choice1';
if(parseInt(array2.indexOf(current.category.toString())) > -1)
//current.u_description = 'choice2';
})(current,previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2017 08:58 AM
Hi Rohit,
are you getting those choices from any table ?
can you please share the screenshot of your field choices? i am not sure but this requirement can be achievable without using script. i would again refer my first reply . would you mind to try that .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2017 09:38 AM
Hi Rohit,
This can be achieved very easily by following steps,
A Choices :
B Choices :
1. Open the record form, and right click on B field and click on 'Configure Dictionary',
2. In the Dictionary entry, click on 'Advanced View' in the related link.
3. Scroll down and click on 'Choices' tab in the related list section,
Note: Here 'Dependent Value' refers to A field's value. You can simply specify for what A field's value which B field's value will be visible.
Output :
Hope this helps.
Do not feel shy to mark correct or helpful answer if it helps or is correct.
Best Regards,
Nitesh Asthana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2017 10:54 AM
nitesh_asthana mate i know and i had already proposed this solution. please check my first reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2017 11:13 AM
harshvardhansingh Yes I had already seen your reply buddy. The link you provided tells how to make a field dependent only. Since he mentioned he is very new to ServiceNow, I elaborated the steps in more details with examples so that he doesn't get confused.
The intent of both of us is to help him achieve what he is looking for. Cheers!!
Best Regards,
Nitesh Asthana