Hi,
So we're creating some templates for starters/leavers and one thing I'd like is to include a custom field (start date or end date) in the subject along with the starter/leavers name. I've gotten so far, but I can't work out how to parse the custom date.
I've seen a few examples on here, but none seem to work or, are several years old.
This is my script and it works perfectly except I'm sure I need to format the date value, just not sure how to get that part working properly. I'd also like it formatted to DD/MM/YYYY
Can anyone help?
var subjectPrefix = "New Starter - "
var firstnameUDF = "udf_char5";
var lastnameUDF = "udf_char6";
var startdateUDF = "udf_date5"
var firstname = await CS.getValue("udf_fields."+firstnameUDF);
var lastname = await CS.getValue("udf_fields."+lastnameUDF);
var startdate = await CS.getValue("udf_fields."+startdateUDF);
firstname = firstname != null? firstname.trim() : "";
lastname = lastname != null? lastname.trim() : "";
CS.setValue("subject",subjectPrefix + firstname + " " + lastname + " " + "Start Date - ");
CS.end();