Current Date is not updated in Business Process

Hi Team,

 

A business process was triggered on 01/11/2022 at 00:12, and there was a field which needs to get updated with Current date. But it got updated with the previous date i.e. 31/10/2022. Earlier it was working fine, just got the issue yesterday.

 

Please help

Like 0

Like

3 comments

Hi,

This could be possible if you run the business process under a user with a different time zone.

We get the current date with this line:

((DateTime)UserConnection.SystemValueManager.GetValue(UserConnection, "CurrentDateTime"))

 

UserConnection.CurrentUser.GetCurrentDateTime()

 

public DateTime GetCurrentDateTime() {
            return TimeZoneInfo.ConvertTimeFromUtc(_dateTimeProvider.UtcNow, TimeZone);
        }

TimeZoneInfo.ConvertTimeFromUtc(_dateTimeProvider.UtcNow, TimeZone);

 

In this, we get a value of UtcNow, and based on the value of TimeZone the method returns the date.

Thank you. Yes exactly, this was the issue.

 

Is there any workaround, we can use a specific time zone date for modifying a field everytime the process gets triggered. 

As far as I know, currently, it would be impossible to change because this logic is located inside an application Core. The only possible solution right now is to change the time zone of the user.

I already created a corresponding problem for our R&D team so that you can change this logic inside the application itself. Thank you for helping us upgrade the system.

Show all comments