You need to sign in to do that
Don't have an account?
ketan mehta
Issue with assigning opportunity to a queue.
Hi,
I am trying to assign an opportunity to a queue as below in a trigger.
list<QueueSobject> queueId = [Select q.SobjectType, q.Id From QueueSobject q where q.Queue.Name =:'test-Queue'];
opp.OwnerId = queueId[0].Id;
I am getting an exception as below:
id value of incorrect type: 00G90000001gfFoEAI
Generally i can see all the other ids with length of 15 but the id in exeption is 18 characters...????
Please guide.
I am trying to assign an opportunity to a queue as below in a trigger.
list<QueueSobject> queueId = [Select q.SobjectType, q.Id From QueueSobject q where q.Queue.Name =:'test-Queue'];
opp.OwnerId = queueId[0].Id;
I am getting an exception as below:
id value of incorrect type: 00G90000001gfFoEAI
Generally i can see all the other ids with length of 15 but the id in exeption is 18 characters...????
Please guide.
Now I am able to assign the object to queue. I have just change the query as below in my trigger. It is still retriving the Id with 18 character but working fine.
trigger OnUpsertTestCustomObject on TestCustomObject__c (before insert, before update) {
//Get queue id
list<QueueSobject> queueList = [Select QueueId From QueueSobject q where q.Queue.Name =:'test_queue'];
for(TestCustomObject__c obj : Trigger.new)
{
obj.OwnerId = queueList.get(0).QueueId;
}
}
Thanks a lot for ur help :)
All Answers
Even if you query QueueSObject, you need to use "QueueId" field to get the right Id. not "ID" field.
Hope this helps.
I tried with ur solution but still the same error. I am getting an id as 00G90000001gfFoEAI Still the id is with 18 character.
Ravi,
Admin has rights to configure any object for Queue.
No.. you cannot assign a Queue as owner of Opportunity. It is only for leads and cases.. Correct me if i am wroong
From my custom queue I can set my custom object for the queue. But while on create a custom object and assigning to the queue I am getting an I 18 character Id which throws an error. Refer the screenshot.
Please guide.
otherwise try to remove last 3 char from ur string.
obj.ownerid=queuelist.get(0).id.substring(0,15);
Now I am able to assign the object to queue. I have just change the query as below in my trigger. It is still retriving the Id with 18 character but working fine.
trigger OnUpsertTestCustomObject on TestCustomObject__c (before insert, before update) {
//Get queue id
list<QueueSobject> queueList = [Select QueueId From QueueSobject q where q.Queue.Name =:'test_queue'];
for(TestCustomObject__c obj : Trigger.new)
{
obj.OwnerId = queueList.get(0).QueueId;
}
}
Thanks a lot for ur help :)