Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Flow Designer Action GlideDateTime() add days functions not working

litchick10
Tera Guru

I'm creating a Flow Designer custom action to find dates I might need and the third output is going to be the next weekday however I cannot get the addDaysUTC or addDaysLocal or addDays function to create an output. 

  • Confirmed that if I only try to make output.next_weekday = todaysdatetime; the output is the correct date & time.
  • I also tried monday.getDate(); with no output  
  • NOTE: First two outputs work as expected
(function execute(inputs, outputs) {
  //Output the current date (glide_date)
  var todaysdatetime = new GlideDateTime();
  
  outputs.today_datetime = todaysdatetime;
   outputs.today_date = new GlideDate();
  //gets current day of the week
var present = new Date();
var day = present.getDay();
//if (day == 5) {
  var monday = todaysdatetime.addDaysUTC(2);
  outputs.next_weekday = monday;
//}
 
})(inputs, outputs);

find_real_file.png

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

litchick10
Tera Guru

Found my own answer but I'm posting here because I couldn't find answer when I looked. Should have been.

   todaysdatetime.addDaysUTC(2)
	var monday = todaysdatetime.getValue();
  outputs.next_weekday = monday;

View solution in original post

1 REPLY 1

litchick10
Tera Guru

Found my own answer but I'm posting here because I couldn't find answer when I looked. Should have been.

   todaysdatetime.addDaysUTC(2)
	var monday = todaysdatetime.getValue();
  outputs.next_weekday = monday;