- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 12:21 AM
Hi all,
I have an issue with an inbound action, it consumes an additional RITM record number. i.e. If you send two emails, the RITM are RITM0010088 and RITM0010090 (skipping ...89) but the corresponding REQs do not skip a number REQ0010074 and REQ0010078.
Any idea of what is going on?
Below is the Email inbound action script :
createRequest();
function createRequest() {
var cart = new Cart(); //calling the cart API
var item = cart.addItem('7ae405904f31220070827ab28110c71a'); //sys_id of the catalog item I want to fire
cart.setVariable(item, 'request_short_description', email.subject.toString());
cart.setVariable(item, 'request_description', email.body_html);
cart.setVariable(item, 'short_title', email.subject.toString());
cart.setVariable(item, 'Location','1');
cart.setVariable(item, 'mobile_number','123456' );
// set the requested for
var gr = new GlideRecord("sys_user");
gr.addQuery("email", email.from);
gr.query();
if (gr.next()) {
var cartGR = cart.getCart();
cartGR.requested_for = gr.sys_id;
cartGR.update();
}
var rc = cart.placeOrder(); //this launches the catalog item, and creates a request object. rc = the request object
updateRITM(rc.sys_id); //call a function immediately to update the ritm. This must be a nested function, otherwise inbound actions get weird.
//also, we're passing the sys_id of the request so we know what RITM to grab.
}
function updateRITM(req){
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', req); //req is what we passed from the previous function. the sys_id of the request.
ritm.query();
while (ritm.next()){
ritm.u_customer = gs.getUserID(); //my ritm table separately tracks its own customer, since I don't use Request
ritm.description = email.body_text; //we're still in the inbound action so why not exploit?
ritm.priority = email.body.priority; //good example of how to exploit email body variables
ritm.short_description = email.subject;
ritm.update();
}
}
current.setAbortAction(true);
event.state="stop_processing";
Thanks in advance for any assistance.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
-
Team Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 01:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 02:12 AM
Ideally , Number field should be populated.
I test this in my instance and its working fine with property set to true. And also target is populated with value. Was this issue is only after enabling property?
What if the property is set back to false?