1
votes

Previously i am sending a form as a doclink using @functions

Eg: @MailSend("Mary Tsen/";"";"";"Follow this link";"";"";[IncludeDocLink])

Please tell me how to send a mail message that includes a doclink in XPages using Serverside JavaScript.

thank you

2
I'm going to answer how to do using SSJS since I am thinking that is what you actually meant - Dwain Wuerfel

2 Answers

4
votes

The concept of a doclink in a web application don't exist. Therefore you must create an email and include a URL to the specific element. Not sure if using XPINC allows adding of a doclink.

email = database.createDocument();
email.replaceItemValue("Form", "Memo");
email.replaceItemValue("Subject","Test");
email.replaceItemValue("Body","You have email");
email.replaceItemValue("SendTo", sendto);
email.send(false);

In the past what I have done to include a link was to reconstruct the URL, as shown below, for the XPage and add that to the body of the message.

I used a viewPanel link for my scenario, but this should get you down the proper path.

var url:XSPUrl = context.getUrl();
var doc:NotesDocument = row.getDocument();
var unid = doc.getUniversalID();
var scheme = url.getScheme();
var host = url.getHost();
var db = database.getFilePath();
pdfurl = scheme + "://" + host + "/" + db + "/0/" + unid;
1
votes

You can add a doclink to a rich text item using something like the code below.

    var docEmail:NotesDocument = database.createDocument();
    var rtitem:NotesRichTextItem = docEmail.createRichTextItem("Body");

    docEmail.replaceItemValue("Form", "Memo");
    docEmail.replaceItemValue("SendTo", "Your recipient");
    docEmail.replaceItemValue("Subject", "Your Subject");

    rtitem.appendText("Some text here... ");
    rtitem.addNewLine(2);
    rtitem.appendText("Click here to view the document => ");
    rtitem.appendDocLink(thisdoc, "Some comment text");
    rtitem.addNewLine(2);

    docEmail.send();