You need to sign in to do that
Don't have an account?
Pete Watson 5
Update Case Owner when Out of Office checkbox = true on user profile
Hi, firstly thanks for reading!
I'm hoping someone can help - I need a trigger to update all cases owned by a user (to queue 'Aftersales') when a checkbox = true on a user profile (out_of_office__c).
Any help would be greatly appreciated!
Many thanks in advance
I'm hoping someone can help - I need a trigger to update all cases owned by a user (to queue 'Aftersales') when a checkbox = true on a user profile (out_of_office__c).
Any help would be greatly appreciated!
Many thanks in advance
Greetings!
Here is the sample code which helps you and please make changes according to your bussiness logic:
Make sure to query the queue using the QueueSObject class.
Also,there is an another approach which is to use the Process builder instead of the apex trigger to update the case owner to queue as per your logic.
Please check the steps and try it in your org:
https://www.soliantconsulting.com/blog/salesforce-process-builder/
Kindly let me know if it helps you and close your query by marking it as best answer so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
Triggers are not allowed on profile. If you attempt to write a trigger on profile, you will get the following error
SObject type does not allow triggers: profile
Assuming out_of_office__c is a checkbox field on the user, your code will look something like this
This is just a sample, please modify as it suits your requirement
Let me know if it helps
Anudeep
You can use below pieces of code (Serves your purpose to assign Owner to "Aftersales" Queue, when current case owner is Out of Office)-
May the force be with you!
Thank you very much to both Anudeep and 'footprints on the moon'. Anudeep, the final variation of code used was very similar to yours but neither where able to return the queue id i'm afraid.
Shirisha, thanks for your comment. The issue with process builder was that the record needed to be updated for the process to fire and thus needed to come from a trigger. But combining the two has worked well.