I have a trigger (AfterUpdate) on the Case object. In here, I am comparing the Owner field in this way:
if((newCase.OwnerId != oldCaseMap.get(newCase.Id).OwnerId)
&& (tempMap.containsKey(newCase.OwnerId))) {
//some code
}
I have Case assignment rules that changes the Case ownership with some specific user/queue(s) based on changes to Status value(s). But, whenever I change the Status value, and Save the record, my Trigger is kicking in. But, as Case Assignment rules fire once the data commits to database, my Owner is remained with older value.
My understanding, Case Assignment rules are firing in current way: After initial commit. But, I am not having any control in terms of Trigger context as the initial commit is completed without any change in Case Ownership, thus my After Update is failing.
If anyone have any workarounds in this scenario, I would really appreciate.
If()
statement, but as my Case Assignment Rules fire later (after initial data commit), mytempMap
was unable to contain the newCase's OwnerId. Once the Case Assignment Rules get fire, Ownership gets changed, but AFAIK, we might not be able to get a hold of that DML operation.