- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2014 02:31 PM
I have a requirement to auto-create catalog request through email inbound action, my approach is to use the Cart API(any better solution?) in inbound action script, I set up the inbound on sc_req_item table but I am not doing a current.insert() otherwise it will double submit the request(as the order is already placed through Cart API), things working fine but one problem I don't find a way to attach the original inbound email to the Activity field, any idea?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-27-2014 03:56 AM
Here are some ideas:
Option 1: Add Message to Comments
Inbound Action: Create Requested Item
Table: sc_req_item
Condition: <your condition here>
Script:
createRequest();
function createRequest() {
var cart = new Cart();
// add in cart
var item = cart.addItem('8c2a069c242cb800839dec45b40a7496');
// set requested for
cart.setVariable(item, 'requested_for', '5136503cc611227c0183e96598c4f706');
cart.setVariable(item, 'request_short_description', email.subject.toString());
cart.setVariable(item, 'request_description', email.body_html);
cart.setVariable(item, 'request_type', 'others');
// set application
cart.setVariable(item, 'application', '3243d574bd05300071578913764fb117');
// set assignment group
cart.setVariable(item, 'assignment_group', '4769d53099266800d7ea6843423a4c2b');
cart.setVariable(item, 'priority', 'PR3');
var cartmsg = "received from: " + email.origemail + "\n\n" + email.body_text;
cart.setVariable(item,'comments',cartmsg);
var rc = cart.placeOrder();
}
Option 2: Generate without Cart API
Inbound Action: Create Requested Item
Table: sc_req_item
Condition: <your condition here>
Script:
createRequest();
function createRequest() {
//Create Request
var grRequest = new GlideRecord ("sc_request");
grRequest.initialize();
grRequest.requested_for = '5136503cc611227c0183e96598c4f706';
grRequest.short_description = email.subject.toString();
grRequest.description = "received from: " + email.origemail + "\n\n" + email.body_text;
var requestSysId = grRequest.insert();
//Create Request Item
current.requested_for = '5136503cc611227c0183e96598c4f706';
current.short_description = email.subject.toString();
current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
current.cat_item = '8c2a069c242cb800839dec45b40a7496';
current.parent = requestSysId;
current.request = requestSysId;
current.request_type = 'others';
current.application= '3243d574bd05300071578913764fb117';
current.assignment_group='4769d53099266800d7ea6843423a4c2b';
current.priority= 'PR3';
current.insert();
}
I tested Option 2 and it did work for me. I used a different Catalog Item (Dev Laptop), because I didn't have your item in my catalog, but most everything else worked the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2016 03:34 AM
Hi Mike,
current.variables.<your_variable_name>, its not working. Do you have any other solution for adding the variable value by using non cart approach.
Thanks
Ankul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2017 01:53 AM
you arte the inspiration for my solution... thank you...
Dear All,
I now have a working solution. Its not great or pretty but does the job... I will be 'sexing' this up at a later date. How... well that might be another post.
Here is the solution I have implemented...
I first created a test item called 'Iams test starter'. which I added a workflow to & tested called 'PB - Service Cat Request > LM Approval > SD'
Then did this on the first tab
Then with adding some comments... some of which could be deleted I put this into the actions tab
and the script
and the bottom...
Its NOT perfect. But it does create a new REQ, RITM & then 'using the workflow' creates the task... Im not a developer. So hopefully this will help someone.
I'll also copy this into the other linked posts... Thanks to you ALL for your help & feedback.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-24-2018 08:52 AM
mkaufman's option 2 above did not work for me. Yours did. Thank you BOTH for sharing this w/ the world!
[edit] Note: In my system I had to tick the box next to 'Stop processing' otherwise it would create the request and request item and then also create an incident based on incident inbound action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2015 02:42 PM
Hello Steve,
I was going through this thread as I had a similar problem. I am using OPT 2, creating both REQ and RITM.. However, I CANNOT get the workflow to fire. I am positive I have the proper WF associated. I have the following condition on my 'Show Workflow' UI Action:
!current.cat_item.workflow.nil() && !current.context.nil() && gs.hasRole('admin')
I am not seeing the UI Action pop, indicating to me that the WF is not firing whatsoever. I do not see a resolution here to the workflow disconnect problem, rather 'make sure your have a WF associated to item'
I am hoping you can provide some insight.
Thank you,
-Darrin
Here is my script:
createRequest();
function createRequest() {
//Create Request
var grRequest = new GlideRecord ("sc_request");
grRequest.initialize();
grRequest.requested_for = sys_email.user_id;
grRequest.short_description = email.subject.toString();
grRequest.description = "received from: " + email.origemail + "\n\n" + email.body_text;
var requestSysId = grRequest.insert();
//Create Request Item
current.requested_for = sys_email.user_id;
current.short_description = email.subject.toString();
current.description = "received from: " + email.origemail + "\n\n" + email.body_text;
current.cat_item = 'fb31a7780fb53500b0b246ace1050e9f';
current.parent = requestSysId;
current.request = requestSysId;
current.request_type = 'others';
current.assignment_group='92b67c5b0f86a100b0b246ace1050e41';
current.priority= '3';
current.insert();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2014 02:25 PM
Hi Mike,
How would I pass the assignment group to the catalog task? Also, my due_date field is not populating. It is based on the SLA workflow.
Thanks in advance,
RV