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
GAURAV SETHGAURAV SETH 

Allow Task(s) to be assigned to a Queue

Spring 2020 release notes says that we can assign Tasks to queue.
I am able to assign task to any queue from task screen but it doesn't our problem of assigning task to queue using trigger or from process builder.

We have a requirement to create a new task and assigned to queue whenever any new case is created ?How can I achieve that?

Thanks,
Gaurav Seth
SUCHARITA MONDALSUCHARITA MONDAL
Hi Gaurav,
You can try something as below : (I'm doing with Opportunity)

trigger trigOpp on Opportunity (after insert, after update){
    Set<Id> changeOppId = new Set<Id>();
    List<Task> taskList = new List<Task>();
    Group g = [Select Id from Group where Type = 'Queue' AND NAME = 'Test' LIMIT 1];
    ID qId = g.Id;
    
    for(Opportunity opp : Trigger.new){
        
            Task newTask = new Task();
            newTask.whatId = opp.Id;
            newTask.subject = 'Task'+opp.Name;
            newTask.ownerId = qId;
            taskList.add(newTask);
        
    }
    insert taskList;
    
}

Share your thoughts!

Thanks,
Sucharita
viswanath reddy 53viswanath reddy 53

Hi GAURAV SETH,

It looks like our team of experts can help you resolve this ticket.
We have Salesforce global help-desk support and you can log a case and our Customer Success Agents will help you solve this issue. You can also speak to them on live chat. Click on the below link to contact our help-desk. Trust me it is a support service that we are offering for free!

https://jbshelpdesk.secure.force.com

Thanks,
Jarvis SFDC team