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
makeItRainmakeItRain 

Queue Name = String

Hello,

 

I'm tired of racking my brain on what seems to be a simple trigger and hoping someone can help. I'm trying to asssign an effort level on our Leads based on the queue it's assigned to. I need to take the queue name and convert it to a string, where it'll match the same string value on an unrelated object. The first concern is I'm not even sure I'm doing this right. Am I even querying for the right queue objects? My trigger is as follows:

 

trigger updateLeadEffort on Lead (before insert) {

  Set<Id> ownerIds = new Set<Id>();
  for (Lead l : Trigger.new)
      ownerIds.add(l.OwnerId);

  Map<Id, QueueSobject> q = new Map<Id, QueueSobject>([SELECT Id, Queue.Name from QueueSobject WHERE Id IN :ownerIds]);
  
  for (Lead l : Trigger.new) {

         if q.get(l.OwnerId).Name == customObjectField__c {
           l.effort__c = 'high';
    }
    else {
             l.effort__c = 'none';
    }
  }
}

 

Any help on enlightening me would be awesome. Thank you.

Best Answer chosen by Admin (Salesforce Developers) 
stcforcestcforce

looked at

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_queuesobject.htm

 

Gist is, queues are groups whose type are queues, so you need to perform a search on the group to find the queue's name.

All Answers

stcforcestcforce

looked at

http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_queuesobject.htm

 

Gist is, queues are groups whose type are queues, so you need to perform a search on the group to find the queue's name.

This was selected as the best answer
makeItRainmakeItRain

Ughh...that was too easy. Thank you.

 

Select Id,Name from Group Where Type = 'Queue'