- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 06:26 AM
Hello,
I want to have a record producer name to map to particular field in my incident / request / change table.
For that I want to take advantage of Script functionality available with Record Producer. however, with the help of producer. (producer dot) I could not pull record producer name in my script.
Can any 1 help me in this case?
Solved! Go to Solution.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 08:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 09:51 AM
Hello Mark,
Can you throw some light on condition 'current.script.indexOf('Force population of record producer') == -1'?
What does this condition does?
I am getting an error message when I try to submit it in demo instance.
Error message is illegal character at line 1 character 24.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 09:58 AM
Your issue is probably with the single quotes in that line. It's a browser copy/paste issue. If you copy from the SNGuru article, then paste into notepad or some other text editor before pasting into ServiceNow that should fix the issue.
That particular line just checks for the presence of the code snippet in the Record producer 'Script' field so that we don't repeatedly add the same info again and again on each update.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-22-2015 07:13 AM
Let's see.. Current setup of service now will not allow us to do this (Per my knowledge).. But have a 2-step trick ...
First create a variable on record producer and have a onload script (Better approach a variable set with the client script so that this can be reused)
In the client script , load the sys id of the record producer to the variable ...
Use > $('sysparm_id').value
Now read this variable in your producer script and get the name of the producer...
var getRecordProducerName = new GlideRecord('sc_cat_item_producer');
getRecordProducerName.addQuery('sys_id',producer.variablename);
getRecordProducerName.query();
if(getRecordProducerName.next())
{
getRecordProducerName.name // this will give you the name of the record producer
}
Theoretically should work just fine ... Makes sense to you all ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 11:50 AM
Just thought I'd update this post, should someone else come looking -->
In the record producer script, you can use:
RP.getParameterValue('sysparm_id');
to get the sys_id of the record producer itself. I would then suggest querying sc_cat_item_producer or sc_cat_item to grab the name of the record producer to print wherever you need it, OR, add a new field to the table that is a reference to one of those tables, and use the RP script set that reference field to what you see above!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-28-2019 12:20 PM
not working
Please appreciate the efforts of community contributors by marking the appropriate response as the correct answer and helpful. This may help other community users to follow the correct solution in the future.
********************************************************************************************************
Cheers,
Prashant Kumar
ServiceNow Technical Architect
Community Profile LinkedIn YouTube Medium TopMate
********************************************************************************************************