Javascript to Find String in URL and Return an Email Address
AnsweredHi guys,
I am trying to create some Javascript to look at the URL of an uploaded document within a folder structure. If it finds text within that URL I want it to return a set string (an email address). Currently the code below works but just for one document wherein DThale is contained within the URL. How do I add to this code to check for other values and then subsequently output other email addresses?
var a = [[FileRef.Value]];
if (a.indexOf('DThale') > -1) {
return "email@address.com";
} else {
return "";
}
0
-
Hi Dan Thale
As discussed in our session yesterday you can just extend your script like this:var a = [[FileRef.Value]];
if (a.indexOf('DThale') > -1) {
return "email@address.com";
}
if (a.indexOf('AnotherUser') > -1) {
return "anotheremail@address.com";
}
if (a.indexOf('AnotherPartOfFolderName') > -1) {
return "somebody@address.com";
}
return "";0 -
Thank you Christof!
0
Please sign in to leave a comment.
Comments
2 comments