Is it possible to use a record producer to create multiple ticket types?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 12:09 AM
Hi there, I want to create a high level record producer that has the ability to raise multiple ticket types. I have tried this using glidescript to no avail.
What I'm trying to achieve is a record producer that works out what ticket type is required by the answers that are provided along the way. So if we had a question "Is the piece of software you are using not working properly" it would know to raise an incident ticket, but if they select no, it could raise a request ticket for example.
The reason for this is that users are constantly logging tickets under the incorrect ticket type, and we are trying to remove the human error from the process as much as possible.
If record producers cannot be used in this fashion, is there a suitable alternative? I have had a look at wizards, but these seem very slow to build, looking for something I can script more of in the back end ideally.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 01:55 AM
Hi Craig,
Record producer can have only 1 target table so if you want to create records based on value selected i.e. either incident record or request record better to go with maintain item and in workflow check what value user has selected and use run script to create record in respective target table.
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2019 07:22 AM
Hi Craig,
I think it might be possible - assuming you'd be okay with each of these filled out forms would create 2 records:
1x Dummy record (as you will have to select a table for your record producer)
1x Actual record (Incident, Catalog Task, ...) depending on the choice.
Though the workflow solution mentioned above would work pretty similar.
Haven't tried this though.
Gwen
if (producer.whatstheissue == "Software Issue")
{
var softwareincident = new GlideRecord('incident');
softwareincident.initialize();
softwareincident.short_description=producer.example1;
softwareincident.callerid=producer.caller_id;
softwareincident.insert();
}
if (producer.whatstheissue == "I need extra software")
{
var softwareinstall = new GlideRecord('catalog_task');
softwareinstall.initialize();
softwareinstall.short_description=producer.example1;
softwareinstall.callerid=producer.caller_id;
softwareinstall.insert();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-08-2019 08:50 AM
I found the answer to this (sorry, logged in on my workprofile, sorry for any confusion!).
I wanted to post this as it will help anyone else looking to do the same. The key is to stop the record producer from processing at the very start, otherwise regardless what you do it will still raise the ticket of the table type specified in the record producer. Here is a stripped down version of the script I used:
current.setAbortAction(true);//cancel creation of global record
if(producer.your_field_here == 'answer')
{
gs.log('In the incident if statement', 'CJ');
var incGR = new GlideRecord('incident');
incGR.initialize();
incGR.short_description = producer.short_description;
incGR.description = producer.description;
incGR.insert();
var link = '<a href="incident.do?sys_id=' + incGR.sys_id + '" class="breadcrumb" >' + incGR.number + '</a>';
var message = 'Your ticket ' + link + ' has been created. Please click on the link to go to the ticket<br/>';
message += 'Thank you for your submission.';
}
else
{
var reqGR = new GlideRecord('sc_request');
reqGR.initialize();
reqGR.short_description = producer.short_description;
reqGR.description = producer.description;
reqGR.insert();
}
reqGR.insert();
var link = '<a href="sc_request.do?sys_id=' + reqGR.sys_id + '" class="breadcrumb" >' + reqGR.number + '</a>';
var message = 'Your ticket ' + link + ' has been created. Please click on the link to go to the ticket<br/>';
message += 'Thank you for your submission.';
}
I took this from another post, which can be found here:
Big shout out to elemonnier for the post