Solved

Date value changes from Workflow into Task Form?

  • 18 August 2020
  • 3 replies
  • 79 views

Hello, 

 

I have a component workflow that takes a date/datetime value from Salesforce and enters the date into a task form. The date in the form is different than the date in the workflow, and I am wondering how I can fix that.

 

Example: In the workflow, if I use log to instance details, I can see that the date value is for example "2020-05-05." (May 5th, 2020). However, in the task form, this date will appear on a date form field as May 4th, 2020. And if I show the time on the form control, it will be May 4th, 2020 6:00pm. 

2 screenshots:

8726iE59BDE9E82A8145A.png

 

8725i1376164144BAAC06.png

 

icon

Best answer by jwCbank 19 August 2020, 21:15

View original

3 replies

Userlevel 6
Badge +22
Hi,

Dates can always be tricky in SharePoint.
I assume your timezone is GMT -6 based on this output.
SharePoint is assuming the date that is retreived from Salesforce is GMT so when it adds to SharePoint it makes the adjustment.
Running the Salesforce date through a calculate date action before use may resolve this issue.
Userlevel 5
Badge +19

@jwCbank yeah that's pretty weird. I have to assume it has to do with the date data being pulled and somehow converted to UTC and then trying to do some auto adjustment based on server time, but...not 100% sure without doing a comparison of your SFDC environment and where you're located. 


 


You should be able to work around this with a two step process.


1. Leverage the 'Format date to string' action to ensure that the date variable is held in your local timezone (or forced to UTC)



 


2. Within your task form use the 'convertToDate' function to convert your txt variable back into a date as the default value:



 


Let me know if that helps!

Thank you for the explanations and responses @SimonMuntz and @butlerj 

I did find it easiest to just run the date through a calculation, and just used a form rule to perform that. From my testing it seems to solve the issue perfectly. 

Reply