Create request via inbound action

suru2
Tera Contributor

Hi All,
I have one requirement on to create request via inbound action and all details in the email body must be set in variables of the catalog item. Could please help me on this to get the proper solution.

 

Thanks

2 REPLIES 2

M Ismail
Tera Guru

Hi @suru2,

Checkout this 
https://www.servicenow.com/community/developer-forum/fill-out-the-variables-of-an-item-using-inbound...

Please hit helpful and accept this as a solution if it solved your problem.
Thankyou

p_kanczugowski
Tera Guru

Hi @suru2, you can achieve that by creating an intermediate table and a transform map, which can then be used for processing the data the script of the inbound email action.

 

First, grab the data in the email body, parse them, trim them, and clean them as much as you can. I recommend playing with regex heavily, and not rely on a single write-only query. Take your time to fine-tune them. Then,  create records in the intermediate table.

 

The following function will trigger the default transform map:

 

 

 

function transform(importSetGR) {
    var transformer = new GlideImportSetTransformer();
    transformer.transformAllMaps(importSetGR);
    return transformer.getImportSetRun();
}

 

 
That being said, using email as data source is rather dangerous and difficult to control for data quality, and shouldn't be used for anything where precision is key. If it can't be helped, I recommend using as many safeguards as possible.
 
Please mark this response as useful and the question as solved if the issue has been solved. Thank you!