• makeItRain
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

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.

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.