Parsing an Inbound Email action to set variables in a Service Request

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2009 11:03 PM
I need help setting up an an inbound email action which will parse the content to create a Service Catalog Request and set variables in the same Request. I am able to create the Request, but have not been able to set the variables. I would like to know how to set both variables and variable sets. Following is what I have tried.
gs.include('Cart');
var cart = new Cart();
var item = cart.addItem('478d5f3e0a0a3c0d378e4423fbd5fec8');
if (email.body.RequiredBy!= undefined)
{
cart.setVariable(item, 'Required By', email.body.RequiredBy);
}
if (email.body.Options!= undefined)
{
cart.setVariable(item, 'Options', email.body.Options);
}
if (email.body.TV2!= undefined)
{
cart.setVariable(item, 'TV2', email.body.TV2);
}
if (email.body.Accounts!= undefined)
{
cart.setVariable(item, 'User Accounts Request', email.body.Accounts);
}
// if (email.body.lts!= undefined)
// {
// cart.setVariable(item, servicelist.lts, email.body.lts);
// }
var rc = cart.placeOrder();
Thanks, Bill
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2009 04:42 PM
In the script I provided you should be pulling fields in to the function from the email. So my first line in the fuction reads:
function orderGeneric(requestedFor, group, desc) {
I am pushing the "requestedFor" from the email. My inbound has this line:
if (email.body.requested_for != undefined )
var requestedFor = email.body.requested_for;
Then calls the function:
// call to business rule Generic Item Order
orderGeneric(requestedFor, group, desc);
You should be able to set the request for or user in your cart function to the "requestedFor" that you passed in from your email.
Being that you are using the cart I don't think you can reach the requested date on the sc_request table. You should be able to personalize that field and put the following default into that:
javascript:gs.nowDate()
That should set the date when the request is place via the email.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-07-2009 02:10 PM
Thanks for this script - exactly what I was looking for.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2010 06:53 AM
Hi,
Have any of you tried to add variables in the request and not in the item?
so that the item get's those variables.
also with what you did, do you have a screen alternate for the shopping cart since you don't use it? or just create everything via email ?
thanks