Populate fields from email from inbound email action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 05:34 PM
Hi,
How to populate fields from email if it has same name but it is under different section. I am attaching my email. In the email it contains Problem Number 1 , Problem Number 2 and Problem Number 3 under each it has issue and details. So i want to populate Problem Number 1 Issue into Issue 1(In service now form field) and Details into Details 1(Form field) same like this for Problem Number 2 and Problem Number 3.
Any suggestions
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 05:38 PM
Values in an inbound email can set field values in a task record.
Any name:value pair in an inbound email body gets parsed into a variable/value pair in the inbound email script. The name:value pair must be on its own line. Note that most email clients limit the number of characters allowed per line and may truncate excessively long name:value pairs.
To populate a reference field, use setDisplayValue()
instead. See Redirecting Emails for an example of using setDisplayValue()
in an inbound email action.
For example, if an email body contains this line:
Foo:bar
The inbound email script creates the variable email.body.foo
with the value of bar
. You can use these variables to create conditions such as:
if(email.body.foo!=undefined){ current.[field]=email.body.foo;}
In this example, the script sets the value of [field]
to the value bar
.
~Hit like/Helpful/answered, if it helped to your issue.
Aravinda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 05:58 PM
Hi aravind,
Thanks for the reply. Populating field is not a problem, but in my case i have same name fields repeating multiple times under different sections
like Problem Number 1 in that Issue and Details and in the Problem Number 2 again it has Issue and Details.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 08:13 PM
Please check if this helps.
var arraystr = [];
arraystr = email.body_text.trim().split('Problem Number');
for(var i = 1; arraystr.length >= i; i++){
var prob = [];
prob = arraystr[i].split('\n');
gs.log('details_' + i + ':' + prob[3].split(':')[1]);
gs.log('issue_' + i + ':' + prob[2].split(':')[1]);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-14-2017 09:28 PM
Hi Shishir,
Instead of log messages, How can i pass the values into the form(Issue1,Issue2,Issue3 and Details1,Details2,Details3).
Thanks