0

I am not able to understand why field update is working differently for these two cases.

Workflow field update: ObjectCase
Field to UpdateCase: Target Date Field Data TypeDate Re-evaluate Workflow Rules after Field Change Formula Value

CASE( MOD( DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ), 
0, CreatedDate + 3, 
1, CreatedDate + 2, 
2, CreatedDate + 2, 
3, CreatedDate + 2, 
4, CreatedDate + 4, 
5, CreatedDate + 4, 
6, CreatedDate + 4, 
CreatedDate + 2)

For the case which is created before 6 PM on 6/9/2018(created date in backend 2018-09-06T07:30:11.000+0000), Target date is set correctly as 10/9/2018

But for the other case which is created after 6 pm on 5/9/2018(created date in backend 2018-09-06T04:04:08.000+0000)Target date is set incorrectly as 8/8/2018. It should also be 10/9/2018 according to logic if it depens on backend created date.

I am not able to understand why it is not working.

2 Answers 2

0

while displaying the information in the UI, Salesforce converts the date value to the timezone in which the user profile is configured.

You need to check your TimeZone in by going to your setting.

So if the user profile is set to some GMT value, Salesforce automatically adjusts the time that is displayed in the DateTime field for that particular timezone.

The same thing happening here in your case. When you will query the field in query editor, you will be able to see the value in GMT. But on UI it is adjusted according to your set Time Zone.

for example -I have written the same workflow in my Org. Here you can see the

enter image description here

In the backend, The value is something different. i.e according to GMT

enter image description here

And here is my time Zone:-

enter image description here

The four hours difference in GMT value and my set time zone value. If the created time is after 8 pm, On my UI the createdDate will show the value of the next day. The same thing is happening in your case.

Hope it helps you.

7
  • I am able to understand why value in UI and Backend are different. But why this workflow is setting different value when in backend date is same. It should set target value to 10 Sep in both the cases.Why it is setting value 10th for Ist Case which is correct and 8th for 2nd case which is incorrect
    – Sharmila
    Commented Sep 10, 2018 at 5:27
  • Can anybody please help in this as this issue is affecting a lot of users
    – Sharmila
    Commented Sep 10, 2018 at 5:34
  • @Sharmila when you will query it, you will get both the time as per your GMT value. I will make you more clear if you can share your time zone name. See, If your timeZone is set GMT+04:00 hrs, and you create a record after 8 pm, on UI you will see the date of tomorrow. Before 8 pm, you will see the created date of today only. Commented Sep 10, 2018 at 6:26
  • Yes I understood problem of created date display in UI and backend. I have issue in Target date(Custom field Population). Please find above Workflow rule. For the case which is created before 6 PM on 6/9/2018(created date in backend 2018-09-06T07:30:11.000+0000), Target date is set correctly as 10/9/2018 But for the other case which is created after 6 pm on 5/9/2018(created date in backend 2018-09-06T04:04:08.000+0000)Target date is set incorrectly as 8/8/2018. It should also be 10/9/2018 according to logic if it depens on backend created date. Why it is not working. My Timezone is GMT-5
    – Sharmila
    Commented Sep 10, 2018 at 7:05
  • Can you share your Timezone? Commented Sep 10, 2018 at 7:06
0

I finally got the solution of workflow issue by adding DateValue to every created date in formulae to calculate target date.

CASE( MOD( DATEVALUE(CreatedDate) - DATE( 1900, 1, 7 ), 7 ), 

0, DATEVALUE(CreatedDate) + 3, 1, DATEVALUE(CreatedDate) + 2, 2, DATEVALUE(CreatedDate) + 2, 3, DATEVALUE(CreatedDate) + 2, 4, DATEVALUE(CreatedDate) + 4, 5, DATEVALUE(CreatedDate) + 4, 6, DATEVALUE(CreatedDate) + 4, DATEVALUE(CreatedDate) + 2)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .