- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 08:16 AM
Suppose there is a field called "Type" in a record producer. If the Type is selected as "incident", an incident should be created and if the Type is selected as "problem", a problem should be created. Is this possible? If yes, how can we achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 08:22 AM
Hi @himanibbhat
Try creating the record producer on the Task table
And create a variable of chices type with incident and problem choices and map the variable to the sys_class_name(Task type) field
This way based on the type the incident or problem can be created
Keep choice values as (incident and problem) in the lower case
Regards
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 08:22 AM
Hi @himanibbhat
Try creating the record producer on the Task table
And create a variable of chices type with incident and problem choices and map the variable to the sys_class_name(Task type) field
This way based on the type the incident or problem can be created
Keep choice values as (incident and problem) in the lower case
Regards
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 08:31 AM
you can create script in record producer according to type selected
if (producer.Type == 'incident') {
var gr= new GlideRecord('incident');
} else if (producer.Type == 'problem') {
var gr= new GlideRecord('problem');
}
gr.inc.initialize();
gr.short_description = producer.short_description;
gr.description = producer.description;
gr.caller_id = gs.getUserID();
gr.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 08:34 AM
Hi @himanibbhat ,
Yes it's possible...This can be achieved by adding a script to the Record Producer that checks the value of a specific field (e.g., Type) and creates the corresponding record accordingly.
Add this script in your record producer..
if (producer.variables.type == 'incident') {
current.table_name = 'incident';
current.short_description = 'Incident ABC Servicenow';
current.caller_id = current.user_id;
} else if (producer.variables.type == 'problem') {
current.table_name = 'problem';
current.short_description = 'Problem ABC Servicenow';
current.caller_id = current.user_id;
}
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/