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
EMHDevEMHDev 

DML Error in production, not sandbox - INVALID SOBJECT FOR QUEUE

I am getting a very strange error which only occurs in production, not in the Sandbox.  A lead trigger inserts record(s) into a custom object called a Lead Company.  This all works fine in the sandbox but when I test it in production, I get a DML error saying "invalid sobject for queue" on the insert statement.  I'm very puzzled because the test methods work fine.  Has anyone encountered this before?

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

This error means that you are assigning a Queue to OwnerId for an Sobject that is not configured for that Queue. Please check under Setup > Manage Users > Queues, and make sure that the object you are trying to assign to that Queue is supported (in the Supported Objects column). You can edit the Queue to add the appropriate object to the list. If it is simply assigning to the wrong queue, you should change your code so that it locates and assigns the correct Queue.

All Answers

skodisanaskodisana

Hi,

 

It looks like you are assigning Owner of the Lead i.e Queue to the Custom object Owner i.e Queue.

Because this you are getting this error.

You will also get the same error in Sandbox if Lead Owner is Queue.

Please test once again in Sandbox with the Lead where owner is Queue.

 

Thanks,

Kodisana

sfdcfoxsfdcfox

This error means that you are assigning a Queue to OwnerId for an Sobject that is not configured for that Queue. Please check under Setup > Manage Users > Queues, and make sure that the object you are trying to assign to that Queue is supported (in the Supported Objects column). You can edit the Queue to add the appropriate object to the list. If it is simply assigning to the wrong queue, you should change your code so that it locates and assigns the correct Queue.

This was selected as the best answer
EMHDevEMHDev

Many thanks for this.  The message meant what it said - I just didn't think it through properly.  I've added the custom object to the lead queues now.  Something else is causing a problem now but I'm tracking it down.

 

Many thanks