- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2018 01:10 AM
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2018 02:26 AM
Glad you got it working, please mark an answer correct to close the thread down.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2018 01:58 AM
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);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2018 02:22 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2018 02:26 AM
Glad you got it working, please mark an answer correct to close the thread down.