- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2018 01:40 PM
Team,
I have tried using a script to split an address email by ("@") and get this in 2 slices using length, but it is not working and I am not sure if I am doing it right. I would like to grab only the username (username@domain.com). Could you please help me on this or guide me if there is something already done to achieve this?
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2018 01:45 PM
Please use below to split email address
var email = "john.doe@email.com"; var name = email.substring(0, email.lastIndexOf("@")); var domain = email.substring(email.lastIndexOf("@") +1); alert( name ); // john.doe alert( domain ); // email.com
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2018 01:44 PM
I just used this line of code in an Inbound Action.
// Assuming emailAddress is a string like jsmith@company.com
var userID = emailAddress.split('@')[0];
The split function turns a string into an array of strings, so emailAddress.split('@')[0] would fetch everything preceding the @ and emailAddress.split('@')[1] would fetch everything right of the @

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2018 01:45 PM
Please use below to split email address
var email = "john.doe@email.com"; var name = email.substring(0, email.lastIndexOf("@")); var domain = email.substring(email.lastIndexOf("@") +1); alert( name ); // john.doe alert( domain ); // email.com
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-05-2018 01:53 PM
thank you so much!