Generate a change request through Inbound email action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2017 09:13 PM
Hi,
We have an inbound email action which creates incident but whenever we have "xyz" in the subject line, we need to generate a change request instead of incident.
How can we achieve this please help me to find the solution?
Regards,
Abhishek
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2017 09:16 PM
Hi Abhishek,
You can do it through the Service Catalog API, using the Cart object.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2017 09:19 PM
Thanks Alvarado,
But I don't need to generate request item, I need to generate change request.
Please help me with code.
Regards,
Abhishek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2017 09:23 PM
Hehehe. lol. Sorry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-30-2017 09:20 PM
Hello Abhishek,
Inbound action:
Create new> Type is reply
Table is Incident:
Condtion: Email subject contains: XYZ,
Use the Below sample script for to creating a change request(action of inbound action).
var changeRequest = ChangeRequest.newNormal();
changeRequest.setValue("short_description", current.short_description);
changeRequest.setValue("description", current.description);
changeRequest.setValue("cmdb_ci", current.cmdb_ci);
changeRequest.setValue("priority", current.priority);
changeRequest.setValue("sys_domain", current.sys_domain);
changeRequest.setValue("company", current.company);
changeRequest.insert();
current.rfc = changeRequest.getGlideRecord().getUniqueValue();
current.update();
gs.addInfoMessage("Change " + changeRequest.getValue("number") + " created");
Let me know you need any other information related this.
ServiceNow Commnunity MVP -2018 class.