I make a callout by clicking a button on the page layout of a record(object-ABC)
. The record details are sent to external systems(another salesforce)
system that creates a Case record in the external system. It sends a response with the record Id of the Case and the status of the case back. I update the
case Id and status on the record(object-ABC)
where the integration was initiated using the response I receive from the external system.
The Challenge :
I have a unique scenario here , I have validation rule on object-ABC which does not allow a future date(>today())
for a field named=> Enter_a_date__C.
The user who creates record of ABC object
is in New Zealand time zone and is able to enter 9th Aug in the Enter_a_date__C
field. All fine until now. The problem
occurs when another user with an US Pacific time zone PST tries to click the button to make a callout to external system to create a CASE. The case gets created
however while updating the case ID and Status back in record(object-ABC)
, the validation rule fails and throws an error saying Enter_a_date__C cannot be a future
date. This is because the user is in pacific time zone and when the Case id and status are updated on the record the validation rule kicks in and fails the
record.
What are possible options to overcome this? Is there a way to roll back the CASE that was created in external system if there is a scenario like this? Any suggestions.