How to create Incident from Catalog item based on Certain variable

accsukant
Tera Contributor

Hi All,

I have below requirement how to do that ,please suggest.

there is variable in catalog item  called "are you summited Request or incident ?"

Based on selection of Incident i want to created incident 

How to do that .

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@accsukant 

You can use Run Script in your workflow with sample script below

if(current.variables.variableName == 'Your Value'){

var inc = new GlideRecord('incident');

inc.initialize();

inc.short_description = 'Testing';

inc.insert();

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

2 REPLIES 2

Sam Ogden
Tera Guru

Hi accsukant,

In the workflow for the item you can have an if statement to check the answer of that variable, if it is request continue to create the catalog task, if it is incident, can create an incident via the create task activity and then close the REQ and RITM with a worknote explaining incident created.

I don't think there is a way to stop the creation of the REQ and RITM if the submission is via a catalog item form.  Ideally you would want your end users to be using the correct forms to submit either a request or an incident.  An alternate perhaps would be if they should be creating an incident have a link to the incident record producer rather than submitting the catalog item?

Hope this helps

Thanks

Sam

Ankur Bawiskar
Tera Patron
Tera Patron

@accsukant 

You can use Run Script in your workflow with sample script below

if(current.variables.variableName == 'Your Value'){

var inc = new GlideRecord('incident');

inc.initialize();

inc.short_description = 'Testing';

inc.insert();

}

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader