Skip to main content

In my org  field agent closes a WO and while doing so they may mark a case( linked to WO) for auto completion . A batch would then take this case and set the status to completed. 

We also have validation rule on case to ensure that specific date field on case, Date of issue is same as case creation date. 

 

Problem we are running into is when the case is created by user in Australia for them the date of issue and creation date are same but when batch tries and set the case to complete the validation is hit and batch fail with error. 

 

Per my understanding batch apex should get the date in GMT and should not be converted to running users locale unless you are displaying on UI. Is that correct? In our case we are not displaying batch just update the case status to completed

If not what can i do so batch dont run into validation, bypassing user from validation is not an option. 

 

#Salesforce Developer

2 risposte
  1. 20 mar 2024, 15:10

    Thanks for sharing the link @Ashwini Garwandha . What I am trying to understand is what format would batch get the date value by default if I dont use any date/timezone function()?

     

    Again batch is not printing or showing the details on UI . It just query the case and update the case status.. 

    Reason I am stuck with question and need to know how salesforce works is 

    • every article I read it say to use function to convert the time in user's timezone or format this mean by default the query should be getting the date in UTC.
    • Read lot of salesforce article which says salesforce convert the time in users timezone to display which imply that when queried it is UTC and then to display salesforce does the conversion.. 

    So in my use case above it should get UTC time but why it is not?

0/9000