Expand my Community achievements bar.

Backslashes in an Email Script

Avatar

Level 5

From a button I created in LiveCycle for creating an email, I want the Email body to include hyperlinks based on a text field value on the form. The text field value number is a tracking number RA-12-XXXXX  i.e. RA-12-18530

I would like the cMsg: section of the script to show the following as a hyperlink so the reader of the email can click on the appropriate documents. The file location is always the same but the file name changes based on the tracking number. Thus the file location for tracking number RA-12-18530 would look like:

\\nw\pacfic\title\building\RA-12-18530

However the backslashes for the file location are causing challenges. Javascript misinterprets these backslashes from my intentions. How do I script a string as a hyperlink when it contains backslashes?

RA = RA-12-18530 not in the code but entered on the form

var RAO = xfa.resolveNode("form1.Page1.RA").rawValue;

var loca = "\\nw\pacfic\title\building\";

var filn = loca + RAO;

var newfil = filn.link(filn);

event.target.mailDoc(

{

              bUI: false,

              cTo: "",

              CCc: "",

              cBcc: "",

              cSubject: "Tracking Progress Request " + RAO,

              cMsg: "The following document is ready for your review. I have inlcuded the hyperlink where the document can be found. Thank you for your time and have a great day!"

              + "\n" + "\n" + "\n" + "\n" + "\n"             

              + "The Tracking Letter: " + newfil,             

}

)

;

3 Replies

Avatar

Level 6

Try escaping each backslash with a backslash:

var loca = "\\\\nw\\pacfic\\title\\building\\";

Avatar

Level 5

The correct code to make the file path appear as a URL in the Email body. Note: The newfil variable was not needed for some reason to have MSOutlook create the filn varaible as a url.

var RAO = xfa.resolveNode("form1.Page1.RA").rawValue;

var loca = "\\nw\pacfic\title\building\";

var filn = loca + RAO;

var newfil = filn.link(filn);

event.target.mailDoc(

{

              bUI: false,

              cTo: "",

              CCc: "",

              cBcc: "",

              cSubject: "Tracking Progress Request " + RAO,

              cMsg: "The following document is ready for your review. I have inlcuded the hyperlink where the document can be found. Thank you for your time and have a great day!"

              + "\n" + "\n"        

              + "The Tracking Letter: "

              + "\n" + "\n" + newfil,             

}

)

;

Avatar

Level 5

George thank you for your help. I would like the url to show in the message body as:

i.e. #1                         \\nw\pacific\title\building\RA-12-18530 Enclosure

However when I write the javascript

              + "The Tracking Letter: "

              + "\n" + "\n" + newfil + " Enlcosure",

I don't get the  i.e. #1. above. I get

i.e. #2                              \\nw\pacific\title\building\RA-12-18530 Enclosure

What is my coding error to get the " Enlcosure" part inlcuded as part of the hyperlink? Thank you again for your previous help.

The browser may not show i.e. #1 and #2 correctly. i.e. #1 the entire wording is blue and hyperlinked. In i.e. #2 only the begining to the end of the tracking number 18530 is blue and hyperlinked. The " Enlcosure" part is left off of the hyperlink and in plain text.