You need to sign in to do that
Don't have an account?
Evaluate prior value of owner field.
Hello, I am new to APEX and in programming in general, so apologies for asking these basic questions.
I am trying to create a trigger that evaluates the prior value of the case owner field and if it changed from a queue to a user, update a lookup field (to users) with the new owner, so far I have been unabled to do it and I workarounded this creating a workflow rule that does this evaluation and changes a checkbox to true, I then created a very simple trigger that updates the lookup field if the checkbox is selected(true) , obviously this is not ideal as I would like to create all the functionality in the trigger.
Can someone please provide some guidance in how can all this be achieved in the trigger . How can I say if the priorowner was a queue (or a list of queues) and the new owner is a user, update the lookup field with the new owner.
Many thanks in advance for any help on this.
You can rely on the ID Prefixes of User object - the owner, with prefix '005' and Queue, which technically is a Group object with ID prefix '00G'. The trigger would be:
All Answers
You can rely on the ID Prefixes of User object - the owner, with prefix '005' and Queue, which technically is a Group object with ID prefix '00G'. The trigger would be:
Hi Shamil, thank you so much!. I was relying on the prefix as well but on the WF rule, I didn't know how to do this on a trigger. Thanks again :)