Set a future date in javasscript to use in HTML template

Post Reply
User avatar
JimmyHartington
Member
Posts: 28
Joined: Tue Mar 22, 2011 7:38 am

Set a future date in javasscript to use in HTML template

Post 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?
freddyp
Advanced member
Posts: 413
Joined: Thu Feb 09, 2012 3:53 pm

Set a future date in javasscript to use in HTML template

Post 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
Post Reply