Next Action Date/Time transform not working in Flow

mkegruber
Tera Expert

I am trying to create a flow in ServiceNow to update the **Next Action Date/Time** field to be;

 

the case's created date/time + 30 minutes

 

My assumption/logic is based on the information in the URL Date Time Transform Functions 

 

So what I did was include a flow step to update the Next Action Date/Time with the case's Created value (data pill) then apply an Add Time transform to the Created value by adding 30 minutes.

I also included an unmodified/untransformed copy of the Created value in the Next Action Activity field for reference.

 

2022-11-24 11_34_28-nextactionflow.png

 


The image below is the output of the flow, the date/time boxed in red in the transformed Created value which should have been only 30 minutes greater than the unmodified/untransformed Created value boxed in green.

 

nextactionflow1.png


I am assuming I am doing exactly the same thing as described in the original ServiceNow information page, but I don't know what I am missing?

 

Any insight, would be appreciated.

 

Looking at the output again, I see that the format of the two times is different. But the source is the same for both - so again not sure what is going on here.

 

I did some further triage by dumping various times and transformations into the case's work note to see if it reveals the issue, but I'm more confused now, see below

 

Opened: 24-11-2022 12:19:39

Opened (transformed Date to String-ServiceNow): 2022-11-24 01:19:39

Opened (transformed Date to String-ISO): 2022-11-24T01:19:39Z


Opened (transformed+30min): 2022-11-23 17:49:39


Created: 24-11-2022 12:20:19

Created (transformed Date to String-ServiceNow): 2022-11-24 01:20:19

Created (transformed Date to String-ISO): 2022-11-24T01:20:19Z

Created (transformed+30min): 2022-11-23 17:50:19

 

Did some more triage.

 

In the image below, I changed the flow so it updated the Next Action Date/Time field with the **Opened** value (unmodified). The result is that the correct time is displayed.

 

NextActionDateTime-is-Opened.png

 

Then I updated the flow, this time I applied a transform to the **Opened** value and applied the **Add time** transform, but I set all the values to 0 i.e. add 0 days, 0 hours, 0 minutes, 0 seconds. In theory it should have been the same result, the **Opened** value.

 

But it wasn't, there must be something wrong functionally with my ServiceNow environment.

 

NextActionDateTime-is-TransformedAddTime-is-0.png

 

Has anyone seen this type of symptom, behaviour before? What was the root cause?

 

 

Me again, as a workaround, I going to try substituting the data pill + transform method with a script.

 

I found that the following will insert the case's Opened value into the Next Action Date/Time field correctly, I just need some help on how to add x minutes to this time, i.e. +30 minutes to the opened_at time

 

var new_openDT = fd_data._2__for_each.item.opened_at;
return new_openDT.getDisplayValue();

 

regards

Michael

1 ACCEPTED SOLUTION

Vasantharajan N
Giga Sage
Giga Sage

Please use the code snippet to populate the value

 

var time = fd_data.trigger.current.sys_created_on;
var upDtime = new GlideDateTime(time);
upDtime.addSeconds(1800);  // 30 minutes to add
return upDtime.getDisplayValue();
 
FYR: I've taken incident Resolved field to populate the value in my example
VasantharajanN_0-1669273157959.png

 


Thanks & Regards,
Vasanth

View solution in original post

1 REPLY 1

Vasantharajan N
Giga Sage
Giga Sage

Please use the code snippet to populate the value

 

var time = fd_data.trigger.current.sys_created_on;
var upDtime = new GlideDateTime(time);
upDtime.addSeconds(1800);  // 30 minutes to add
return upDtime.getDisplayValue();
 
FYR: I've taken incident Resolved field to populate the value in my example
VasantharajanN_0-1669273157959.png

 


Thanks & Regards,
Vasanth