Incident and Problem record creation via Record Producer

himanibbhat
Giga Contributor

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?

1 ACCEPTED SOLUTION

Chaitanya ILCR
Kilo Patron

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 

View solution in original post

3 REPLIES 3

Chaitanya ILCR
Kilo Patron

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 

darshan-pra
Tera Expert

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();

kaushal_snow
Mega Sage

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;
}

 

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/