You need to sign in to do that
Don't have an account?
Programatically creating Queue Records with Lead as Supported Object
I am trying to programmatically create a User Queue record that can own Lead records via a trigger . According to the documentation available for Group object
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_group.htm#topic-title
setting Group.Type = ‘Lead’ should achieve this . But, this is throwing an exception at runtime
Apex trigger insertSalesTeam caused an unexpected exception, contact your administrator: insertSalesTeam: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, Type: bad value for restricted picklist field: Lead: [Type]: Trigger.insertSalesTeam: line 33, column 9
If , however , I give Group.Type = ‘Queue’ , it perfectly creates a Queue record as expected , but I have to set ‘Lead’ as ‘Supported Object’ manually .
Have any of you faced this problem ? can you please let us know if there is some work around for this .
If I understood correctly what you are trying to do it can be achieved creating first a Queue type Group object and then associating it to queue Sobject.
I hope this helps, athough I would also like to know what group type 'Lead' actually means.