cancel
Showing results for 
Search instead for 
Did you mean: 

sending document url using mail.parameters.text

e-no91
Champ in-the-making
Champ in-the-making
I wanted to send the document url via mail text on share javascript.

i) I've tried

mail.parameters.text = document.properties.url;

and

mail.parameters.text = document.properties.shareUrl;

both returns null.

ii) I tried copying the whole address based on folder name, such as

mail.parameters.text = companyhome.childByNamePath("Sites/test-script/documentLibrary/test.txt");

this returns server error..


iii) And when I tried

mail.parameters.text = document.url;

I get

/d/d/workspace/SpacesStore/7158a48b-4150-40d1-a65e-1a1c7f42ef5d/T%20-%20Copy%20(10).txt
but I cannot simply use this url.

I feel like I'm almost there, please tell me what I'm missing.

Thanks in advance!
5 REPLIES 5

aaditvmajmudar
Confirmed Champ
Confirmed Champ
Which URL you want to send for document?

If you want to send the path to that document then you can use below method.

"document.displayPath" - Will return the physical path. e.g. /Company Home/Test_Space

Hope this helps.

Thanks for the reply.
But what I wanted is to display the url in mail.parameters.text which is the same as function ${document.shareUrl} in the template file.
How do I achieve this?
I'm using this method now because I cannot pass bpm_template as mail.parameters.template=bpm_mailTemplate in processdefinition, I get template error…

aaditvmajmudar
Confirmed Champ
Confirmed Champ
Can you paste that ${document.shareUrl} value here?

In which file you saw this "${document.shareUrl}"?

Data Dictionary > Email Templates > Notify Email Templates > any ftl files
${document.shareUrl}

From here, it returns
http://127.0.0.1:8080/share/page/site/ar-rahnu/document-details?nodeRef=workspace://SpacesStore/de1d...
which leads me to the file.

I wanted to use the same function on javascript only.
So far I could use document.nodeRef, it returns me
workspace://SpacesStore/de1d5fe3-44b6-48c8-a18f-c4ad21f7c8cd
so I have to add the front part (http://127.0.0.1:8080/share/page/site/ar-rahnu/document-details?nodeRef=) by using string

Is there any way I could directly display
http://127.0.0.1:8080/share/page/site/ar-rahnu/document-details?nodeRef=workspace://SpacesStore/de1d...
using javascript?

aaditvmajmudar
Confirmed Champ
Confirmed Champ
Can you try to build required URL like this:

var docURL = url.server + "/share/page/site/" + document.getSiteShortName() + "document-details?nodeRef=" + document.nodeRef ;

Hope this helps.