Record Producer map to field or current.subcategory =producer.subcategory NOT Working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 10:12 AM
I have a record producer on cases.
I have a field subcategory that looks at the sys_choice table and is displaying only the subcategories which belong to the category I am setting in my record producer.
I have tried to map the field and it doesn't work and I have removed that and done current.subcategory = producer.subcategory and that doesn't work either.
Any one have any ideas why?
Thanks,
Stacy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 10:19 AM
Hi there,
Can you share what exactly is not working? I mean, you did try Record Producer script, what was the outcome of that? Nothing saved at all? Or an invalid value?
Did you debug producer.subcategory? Does this contain the value you would expect?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP
---
LinkedIn
Community article list
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 12:29 PM
So I have tried using a script. My first log shows me the name of the subcategory.
My second log gives me a sysid and the value is the correct one. However, the sysid it is giving me doesn't even exist in the sys_choice table.
This is my script:
gs.info("Stacys sub is " + producer.subcategory);
var sub = producer.subcategory;
var gr = new GlideRecord('sys_choice');
//gr.addQuery('label', 'CONTAINS', sub);
gr.addEncodedQuery('name=sn_customerservice_case^element=subcategory^dependent_value=3510');
gr.addQuery('value', 'CONTAINS', sub);
gr.query();
if (gr.next()){
gs.info('Stacys found gr' + gr.sys_id + gr.value);
current.subcategory= gr.value;
}
This is frustrating, it shouldn't be this hard to get subcategories for record producers.
thanks,
Stacy

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 10:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-03-2020 10:25 AM
Hi Stacy,
Are you also having similar dependency of sub-category on category on record producer as well
Do you have category and sub-category both as variables on record producer?
what value it sets when you set it via script
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader