I have a custom field on Case object named "Random_Field__c". Now my requirement is that whenever the case owner is changed from one queue to another queue, I want to store this new queue value in this custom field. The value should be captured in this field only when the case owner changes from a queue to another queue and not from any user to any queue or any queue to any user.
I successfully achieved this requirement using the PB in which i put the entry criteria as follows and updating the field subsequently oncew the criteria is met and it is working fine :-
AND ( ISCHANGED([Case].OwnerId), NOT(ISNULL([Case].OwnerId)), BEGINS(PRIORVALUE([Case].OwnerId) , "00G"), BEGINS([Case].OwnerId , "00G") )
I want to know how to achieve the same with the help of Apex Trigger. How to fetch the prior value of the case owner as queue or not in Apex and check for the latest value and every other thing.
Please help me out!!! I really wanna know out of my curiosity.
Thanks in Advance, Ali