- 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 01:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 01:49 AM
Thank you Rakesh. It's working fine now.
But in the systems logs email ,it shows the target is empty .why it shows the target as empty instead of RITM number
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 01:54 AM
Hi Karthikeya,
When you set the property, it will allocate number only after the record is inserted.
If the property is false, then even if we open a form and don't submit it . Then that one number will be lost.
May I know on which table this inbound email action is written?
Regards,
Rakesh Mamidi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-02-2017 02:02 AM
Hi Rakesh,
Email inbound action is written on : sc_req_item table.
If the property is set to be true , when i am trying to create a new incident or problem etc.. the number field show as empty.
How to resolve this issue.