Skip to main content
Question

html tags in @mention email notification


Forum|alt.badge.img+4

I'm trying to use the new feature that allows @ mentions in rich text fields, and have set up a custom notification to email users when they've been mentioned. 

I'm trying to get the contents of the rich text field containing the mention to display in the email notification. I selected the field using the 'add elements' dropdown in the 'compose email' section. How do I set up the template so that the contents of the field will be displayed in the body of the email without all the html tags? 

KristaSibery
Forum|alt.badge.img+8

You may have figured this out already, but if not here is the code for this: 

var text Note = ToText([FIELD NAME HERE]);
//specific tags - can replace them all in note instead of one at a time
var text AST= SearchAndReplace($NOTE,"<br />"," ");
var text BST= SearchAndReplace($AST,"<p>","");
var text CST= SearchAndReplace($BST,"</p>","");
var text DST= SearchAndReplace($CST,"<strong>","");
var text EST= SearchAndReplace($DST,"</strong>","");
var text FST= SearchAndReplace($EST,"<ol>","");
var text GST= SearchAndReplace($FST,"</ol>","");
var text HST= SearchAndReplace($GST,"<li>","");
var text IST= SearchAndReplace($HST,"</li>","");
var text JST= SearchAndReplace($IST,"</span>","");
var text KST= SearchAndReplace($JST,"&nbsp;"," ");
var text LST= SearchAndReplace($KST,"&#8203;","");
var text MST = SearchAndReplace($LST,"&amp;","&"); 
var text NST= SearchAndReplace($MST,"</a>","");

var text NoteNew = $MST;

//Glossary
//SPT = Start Position Tag
//EPT = Eng Position Tag

// 1st Tag (A)
var number ASPT = (Length(Left($NoteNew,"<")))+1;
var number AEPT = Length(Left($NoteNew,">"))+1;
var number ALength = $AEPT-$ASPT+1;
var text ATag = Mid($NoteNew, $ASPT, $Alength);
var text ANote = SearchAndReplace($NoteNEw,$ATag,"");
//2nd Tag (B)
var number BSPT = (Length(Left($ANote,"<")))+1;
var number BEPT = Length(Left($ANote,">"))+1;
var number BLength = $BEPT-$BSPT+1;
var text BTag = Mid($ANOTE, $BSPT, $Blength);
var text BNote = SearchAndReplace($ANote,$BTag,"");
//3nd Tag (C)
var number CSPT = (Length(Left($BNote,"<")))+1;
var number CEPT = Length(Left($BNote,">"))+1;
var number CLength = $CEPT-$CSPT+1;
var text CTag = Mid($BNOTE, $CSPT, $Clength);
var text CNote = SearchAndReplace($BNote,$CTag,"");
//Add more as needed
$CNote