Inbound Email action trying to set current.cmdb_ci

matthewhobbs25
Kilo Explorer

Hi

I trying to be able to send and email and use a template in that email to set various incident fields.

I can set all of them as required accept the Configuration Item

I'm using the following successfully (just part of the code and fields I'm matching successfully)

if (email.body.category != undefined){
    current.category = email.body.category;}

if (email.body.description != undefined) {
    current.description = email.body.description;}

And then emailing an incident with the following

Category: Other

Description: Long description

ConfigurationItem: Laptop501

I wondering how I can set the Configuration Item

I've tried

if (email.body.ConfigurationItem != undefined) {

    current.cmdb_ci = email.body.ConfigurationItem;}

this doesn't work..

I need to use the text version not a sys_id within the email template as the system sending the email only understands the text versions.

Thanks

Matt

1 ACCEPTED SOLUTION

Glad you got it working, please mark an answer correct to close the thread down.


View solution in original post

7 REPLIES 7

Hi Mathew,



I recommend chucking in a few log messages to confirm your email.body.ConfigurationItem is returning the right info and then create a variable with it converted to string.



gs.log('this is the CI: ' + email.body.ConfigurationItem);


var configItem = email.body.ConfigurationItem.toString();



if (email.body.ConfigurationItem != undefined) {


current.cmdb_ci.setDisplayValue(configItem);


}


matthewhobbs25
Kilo Explorer

I changed it to configitem instead of ConfigurationItem and it fixed the issue with



if (email.body.configitem != undefined) {


current.cmdb_ci.setDisplayValue(email.body.configitem);}



With Email template


configitem: Access



Thanks you both for responding



matt


Glad you got it working, please mark an answer correct to close the thread down.