- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2016 08:54 PM
Team - I have read a lot on the forums about inbound actions but I am unable to get the following working for me. Any assistance greatly appreciated:
Inbound email subject along the line of:
[REF #1234] Create ticket for outage
Requirement:
Remove REF #1234 from between [ ] and place in a field called u_vendor_reference
Actions tried but not working:
current.u_vendor_reference = email.subject.match(/^[ (.+)$/]);
My understanding is that with the above /^ should signify the beginning of the text to be extracted
$/ should signify the end
and everything between should be extracted and placed in current.u_vendor_reference
Is my thinking to simplistic? Currently on Eureka
Cheers
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2016 09:32 PM
Hi Andrew,
Have you tried this?
var subjMatch = new RegExp("(\[REF #[0-9]*)\]","g");
var subjectExtRef = email.subject.match(subjMatch).toString();
Should get you the whole thing and then you could remove the [ and the ].
This online tool is handy for RegEx:
RegExr: Learn, Build, & Test RegEx
Hope that helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2016 09:32 PM
Hi Andrew,
Have you tried this?
var subjMatch = new RegExp("(\[REF #[0-9]*)\]","g");
var subjectExtRef = email.subject.match(subjMatch).toString();
Should get you the whole thing and then you could remove the [ and the ].
This online tool is handy for RegEx:
RegExr: Learn, Build, & Test RegEx
Hope that helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2016 10:09 PM
Andrew,
As russell mentioned email.subject.match(/\[REF #[0-9]*\]/g) will give you the reference number and then you can remove the braces by using this
var refArr= email.subject.match(/\[REF #[0-9]*\]/g);
var ref=refArr[0].substring(1,(refArr[0].length-1));
variable ref will give you the desired value.
Thanks,
Abhinay
Please mark Helpful, Like, or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-20-2016 04:19 PM
Thanks for the information - needed to make a few slight changes to the code but these ideas sent me in the right direction and got me 99% of the way there
Much appreciated
Cheers