Page 1 of 1

Set a future date in javasscript to use in HTML template

Posted: Wed Feb 26, 2014 9:07 am
by JimmyHartington
Hi



I have a flow, where I send a link to a pdf via email.

This pdf-file is automatically deleted after 14 days.

Currently in the email I write that the file is available in 14 days.



What I would like is to write to which date the file is available.



I have this JavaScript, which calculates the future data.



var targetDate = new Date();

targetDate.setDate(targetDate.getDate() + 14);



var dd = targetDate.getDate();

var mm = targetDate.getMonth() + 1; // 0 is January, so we must add 1

var yyyy = targetDate.getFullYear();



var dateString = dd + "/" + mm + "/" + yyyy;



return dateString





And have tried to set this script on the JobState, so I can pull in the jobstate into the HTML-template for the email.

But JobState stays blank.



Is there somehow I can set a metadate element for the file instead using the script executor?

Set a future date in javasscript to use in HTML template

Posted: Wed Feb 26, 2014 11:30 am
by freddyp
If you want to store little pieces of information about a job the best approach is to put them in private data. You can find the explanation of the getPrivateData and setPrivateData methods in the Job class.



Freddy