function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Get Queue name/Id where i picked the Case

Below Scenario:
Step1. I have created a case and assigned it to a Queue(For Ex:Q1)
Step2. One of the users(Usr1) belongs to that Queue (Q1) accepted the case
Step3. Usr1 becomes the owner of that Case
Step4. Now User(Usr1) want to send back case to the same Queue-Q1

How to find the Queue Name/Id where the users picks the Case?
How can we find it?
Any direct solution or Alternate?

I would suggest something like,

1) Create a text field named Original Queue Name
2) Create a process builder which would populate value in this "Original Queue Name" whenever case moves from Queue: Q1
(Also have a condition in process builder which would say once the "Original Queue Name" is populated, don't run it again)
3) Now, whenever your user wants to change the case back to the Queue, hs/she can refer the name from "Original Queue Name" field.

Hope this helps!
Glyn Anderson 3Glyn Anderson 3
I agree with Govind's suggestion, but I would make the field a Lookup to Group (queue).  That way, it will display the queue name to the user, while being an Id that automation can use to set the Owner.  Being a developer, I would use a trigger to set this field anytime the Owner changes to a Queue.  I would allow it to be overwritten in case the Case is routed to a different queue at some point.

trigger CaseOriginalQueue on Case ( before insert, before update )
    for ( Case newCase : )
        Case oldCase = Trigger.isUpdate ? Trigger.oldMap.get( newCase.Id ) : null;
        if  (   (oldCase == null || oldCase.Owner != newCase.Owner)
            &&  String.valueOf( newCase.Owner ).startsWith( '00G' )
            newCase.Original_Queue__c = newCase.Owner;
Glyn Anderson 3Glyn Anderson 3
Typo alert:  Everywhere I have ".Owner", it should read, ".OwnerId".  Sorry.
Glyn Anderson 3Glyn Anderson 3
Did any of these answers solve your problem?  If so, please mark the question as "Solved".  If not, let us know.  If you solved it yourself another way, please post your solution.  Thanks!