
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 02:10 AM
I am trying to setup an inbound email action that set field values based on the email body text according to this SN article: Setting field values from the email body
How would I be able to read body text that use special characters? One example is that a Swedish user is supposed to write in their first name in the email. First name in Swedish is Förnamn (so the email would be written like Förnamn: Richard, and so on)
if(email.body.förnamn!=undefined) {
current.variables.first_name=email.body.förnamn;
}
That of course, doesn't work because of the special character Ö.
Do I have to tell them to write First Name instead, or is it possible to convert the special character somehow?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 03:02 AM
It seems to have some additional content in the body. Can you check if you are able to access its value in here when you stringify
for (var key in email.body) {
var key = key.toString();
var value = email.body[key].toString();
gs.info("Key: "+key);
gs.info("Value: "+value);
if(key == 'The Value logged'){
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 02:17 AM
Hi,
You can use RegEx expression in the inbound action script itself in order to remove unwanted text received for special character.
Have a look here as an example:
regex: i want to check for particular special characters from input using regex
If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.
Thank you
Cheers
Alberto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 02:17 AM
Have you tried like
if(email.body.förnamn!=undefined) { current.variables.first_name=email.body['förnamn']; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 02:17 AM
Hello Richard,
Have your tried email.body.f_rnamn?
SN should replace all special characters with an underscore. Please try to log it
gs.info("First Name: "+email.body.f_rnamn);
Or
You could try this as well
for (var key in email.body) {
gs.info("Key: "+key);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2019 02:45 AM
gs.info("First Name: "+email.body.f_rnamn);
f_rnamn returns Undefined
for (var key in email.body) {
gs.info("Key: "+key);
}
This logs Förnamn as both fornamn and MmfornamnmM (?)
I have tried both email.body.fornamn and email.body.f_rnamnemail and both returns Undefined