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 09:48 PM
Somehow array is not working for me, but was able to get in this way, see 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');
switch(i) {
case 1:
var details1 = prob[3].split(':')[1];
var issue1 = prob[2].split(':')[1];
gs.log('details1' + details1);
gs.log('issue1' + issue1);
break;
case 2:
var details2 = prob[3].split(':')[1];
var issue2 = prob[2].split(':')[1];
gs.log('details2' + details2);
gs.log('issue2' + issue2);
break;
case 3:
var details3 = prob[3].split(':')[1];
var issue3 = prob[2].split(':')[1];
gs.log('details3' + details3);
gs.log('issue3' + issue3);
break;
}
}
gs.log(details1 + ':' + details2 + ':' + details3 + ':' + issue1 + ':' + issue2 + ':' + issue3);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2024 09:41 PM
When I am not typing email.body it is not taking the refrence.