create an incident with catalog item instead of record producer

Nadir Abbas
Tera Contributor

I have a scenario in which i want to create an incident with the help of Catalog Item instead of record producer. how can i do this?
For this purpose we can use flow design and something else?

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @Nadir Abbas ,

Catalog items are supposed to create requests and requested items but not incidents, it is always best to create Record producer for which purpose as Service catalog will create Request based records rather than record producer records, however you can still create Incident using service catalog and all you have to do is to create 'Workflow' attach it to Service catalog and then in Workflow you can add 'Run script' activity and write simple code which will create incident record. Here is the sample code.

var er = new GlideRecord('incident');
er.initialize();
er.short_description = 'Test';
//if you want to set based on variables of service catalog then write like below
er.short_description = current.variables.sh_description;
er.description = 'Hello';
er.insert();

 

You can create an Incident from Flow Designer, but typically a record producer is the way to go about this.


Example in Flow Designer:

https://www.servicenow.com/community/in-other-news/using-flow-designer-to-create-a-customized-incide...

View solution in original post

1 REPLY 1

Community Alums
Not applicable

Hi @Nadir Abbas ,

Catalog items are supposed to create requests and requested items but not incidents, it is always best to create Record producer for which purpose as Service catalog will create Request based records rather than record producer records, however you can still create Incident using service catalog and all you have to do is to create 'Workflow' attach it to Service catalog and then in Workflow you can add 'Run script' activity and write simple code which will create incident record. Here is the sample code.

var er = new GlideRecord('incident');
er.initialize();
er.short_description = 'Test';
//if you want to set based on variables of service catalog then write like below
er.short_description = current.variables.sh_description;
er.description = 'Hello';
er.insert();

 

You can create an Incident from Flow Designer, but typically a record producer is the way to go about this.


Example in Flow Designer:

https://www.servicenow.com/community/in-other-news/using-flow-designer-to-create-a-customized-incide...