I trying to produce an groovy email post function where a cfValue is assigned to a string, then remove a portion of the string and then place in the html email. Below is the"Email template" with the "Email format" set to HTML, and the current output.
<html>
<body>
<b>Summary: </b><% out << issue.summary %><br>
<b>Separating user: </b><% out << cfValues['Separating user'] %> = Please ignore the
###<br>
<b>UID of Separated: </b><% out << cfValues['UID of Separated'] %><br>
<b>Reports To: </b><% out << cfValues['Reports To'] %><br>
<b>Manager's UID: </b><% out << cfValues['Manager\'s UID'] %><br>
<b>Work Location: </b><% out << cfValues['Work Location'] %><br>
<b>Other Work Location: </b><% out << cfValues['Other Work Location'] %><br>
<b>Effective Date: </b><% out << cfValues['Date Requested'] %>
</body>
</html>
Summary: Separation of Cubicle Monkey
Separating user: klynch:10000 = Please ignore the
###
UID of Separated: test1234
Reports To: klynch:10000
UID: test4321
Work Location: CA02 (GBR) (611 N Brand Blvd, Glendale, CA 91203)
Other Work Location: NA
Effective Date: 2013-03-29 00:00:00.0
I want the Separating user: and Reports To: output to be (no :10000) at the end
Summary: Separation of Cubicle Monkey
Separating user: klynch
UID of Separated: test1234
Reports To: klynch
UID: test4321
Work Location: CA02 (GBR) (611 N Brand Blvd, Glendale, CA 91203)
Other Work Location: NA
Effective Date: 2013-03-29 00:00:00.0
I've tested string replacement with and the output it correct
<script type="text/javascript">
var str = "klynch:10000";
var n = str.replace(":10000","");
document.write(n);
</script>
output shows klynch without the :10000
I tried adding the following inside the body, but it outputs nothing in return and I'm not seeing anything in the log as to why or any error.
<script type="text/javascript">
var str = cfValues['Separating user'];
document.write(str);
var n = str.replace(":10000","");
document.write(n);
</script>
I'm assuming that the cfValues['Separating user'] does not work inside the script tag. How do I get it so that the cfvalue can be stripped of it's :10000 at the end and then placed in the email correctly.
Thanks