Update the time for a date/time field in Flow

Dazler
Mega Sage

Hi,

 

I am trying to create an action in Flow Designer, so that I can add a specific time to a date field.  I got my code to work in Workflow editor, but I am having trouble in Flow.

 

The reason for this is to move our workflows from Workflow Editor into Flow.

 

This is the code that I had in my run script in workflow.

 

    var termDate = current.variables.trm_termination_date;
    var newDate = new GlideDateTime(termDate);
    var arrDate = [];

    arrDate = newDate.toString().split(' ');

    current.variables.trm_date_set_time.setDisplayValue(arrDate[0] + ' 17:00:00', 'yyyy-MM-dd HH:mm:ss');

 

I changed it up some in Flow, but when I test I get no return value.

    var termDate = inputs.term_date;
    var newDate = new GlideDateTime(termDate);
    var arrDate = [];

    arrDate = newDate.toString().split(' ');

    outputs.future_date_with_future_time.setDisplayValue(arrDate[0] + ' 17:00:00', 'yyyy-MM-dd HH:mm:ss');

 

Does anyone know what I am doing wrong here?

1 ACCEPTED SOLUTION

Hello @Dazler ,

 

You have to replace line number 24 with below mentioned line. You have to remove the set Value from there as we are just setting output here and not updating value of variable. once you change the code with below mentioned line it will give correct output.

 

Written In script : 

outputs.future_date_with_future_time.setDisplayValue(arrDate[0] + ' 17:00:00', 'yyyy-MM-dd HH:mm:ss');

Need to Change with : 

outputs.future_date_with_future_time=arrDate[0] + ' 17:00:00', 'yyyy-MM-dd HH:mm:ss';

 let me know if you have any further question.

 

kindly mark as helpful if its solves your query.

View solution in original post

5 REPLIES 5

Thank you, @Sunny15!  It worked.