Create incident from catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 11:22 AM
Hello,
I have below requirement how to do that, please suggest.
there is variable in catalog item called "are you raising Request or incident?"
I used if else condition for that. but when i submit the form by selecting incident. It is still creating request and it also creating incident.
Can anyone help me?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 12:03 PM
Hi @SM123 ,
Instead of a catalog item you need a "record producer", go to Service Catalog > Catalog Definitions > Record producer. If you filter the list with <table> is <incident>, you have a OOB record producer but you can also create your own.
To configure a new record producer :
- choose the target table
- the script part is launch after the record producer is submitted, in this part you can set some fields that are not part of the form of the record producer
- configure your variable. it's similar to a catalog item but you can also "map" directly your variable with a field of the target record. For example a variable "short description" can be map to the "short description" field of the record incident.
Approach 2:
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:
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2024 12:22 PM
Hello @Sumanth16 ,
I am able to create incident without using the script in the flow. But it is creating request, RITM and also incident. That's my issue. I can't use record producer. As there is variable in catalog item called "are you raising Request or incident?" i should be able to create incident OR Request using the flow.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 04:20 AM
Hello @SM123
If you want to prevent generating the request, you should close that request and create an incident instead. However, if you only want to create an incident, changing the out-of-the-box (OOB) behavior is not a good practice. To handle this properly, you should use a Record Producer."
Let me know if this works for you!
Please mark this response as correct or helpful if it assisted you with your question.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2024 04:45 AM