How do I map all variables into the description field & activity log from a record producer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-29-2020 04:20 AM
Good Afternoon!
I have created a new record producer for our "Log an incident form" - its quite complex and includes a few different ui policies (for example, if category is protection then show the the protection variable set) - currently i have all the new variables added to the form and the UI policies and actions working perfectly on the front end catalogue form, but on submission, none of the completed fields are been pulled through to the back end incident.
Can you please advise how i can get this working?
thank you very much ... just an example...
This is our front end form...
As you can see, nothing is mapped across to the back end...
I'm aware its something here that we have to amend...
can you please advise the following;
- what script i need to include all of the completed variables only into the incident record
- how i can amend this going forward if we include more variables sets within the incident record producer
- How i can map all completed variables into the activity log
Thank you
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2021 03:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2022 04:44 AM
Hello
What type of script should we use, and whether that's on demand table or record producer table ?
Also producer.variable1, here producer is it a keyword for all record producers?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2022 01:16 AM
Hi,
You need to use the script in the Record Producer script itself.
Yes, Producer is a keyword here through which ServiceNow identifies Record Producer variables and maps them to the field on the target table.
Refer to the below ServiceNow link for more information:
https://docs.servicenow.com/bundle/orlando-it-service-management/page/product/service-catalog-management/reference/r_CreatingVariablesForFieldTypes.html
Regards,
Surbhi

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2022 01:13 PM
An updated script for getting all producer variables into the description:
var arr_questionSysIds = [];
for (var v in producer) {
if (v.startsWith("IO")) { //only variables
arr_questionSysIds.push(v.substring(2));
}
}
var gr_questions = new GlideRecord('item_option_new');
gr_questions.addQuery('sys_id', 'IN', arr_questionSysIds.toString()); //Single call to the table with all variables we are looking for
gr_questions.orderBy('order'); //Order by the order they are on the catalog item form
gr_questions.query();
var description = "";
while (gr_questions.next()) {
var question = gr_questions.getValue('question_text');
var value = producer[gr_questions.getValue('name')].getDisplayValue();
if (value !== "") { //only get variables with values
description += question + ": " + value + "\n";
}
}
current.description = description;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2022 07:18 AM
Hi @Jon Ulrich
Thank you so much for sharing your knowledge. It is the script I am looking for. Really appreciate it.
Regards
mm