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
Uday Sales1Uday Sales1 

sObject type is not supported

Hello,

I am pretty new to SOQL and I am trying to write a query
List<SObject> quotes = [SELECT Id, Name, QuoteId, Document FROM QuoteDocument];
and I get an error:
"sObject type 'QuoteDocument' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names."

I am trying to build a package and I would like to get the list QuoteDocument if it exists in the Organization and also list should be empty if Quotes are disabled for the organization. How can rewrite the statement to achieve this?

Thank you in advance.

 

Best Answer chosen by Uday Sales1
Uday VUday V
List<sObject> sobjList = Database.query('SELECT Id, Name, QuoteId, Document FROM QuoteDocument where QuoteId = :custom');

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try below line. I hope that will work
List<QuoteDocument> quotes = [SELECT Id, Name, QuoteId, Document FROM QuoteDocument];
 
ManojjenaManojjena
Hi Uday ,
Try with below code it will help !!
List<sObject> objectsList=((List<sObject>)([SELECT Id, Name, QuoteId, Document FROM QuoteDocument]));
Let me know if it helps !!
Thanks
Manoj
 
Sampath KumarSampath Kumar
Hi Uday,

You need to use API name to get the result. Use the following query for resolution.

List<QuoteDocument__c> quotes = [SELECT Id, Name, QuoteId, Document FROM QuoteDocument__c];

Let me know if this helps!

Regards
Sampath
 
Uday Sales1Uday Sales1

Thank you everyone talking time in my issue.

Sampath, QuoteDocument is not a custom object but it is Salesforce object like Account, Case, Lead etc which can be enabled by Setup -> App Setup -> Customize -> Quotes -> Quote Settings. I get this error only if Quotes are disabled for that organization and I can detect it using:

if(Schema.getGlobalDescribe().get('Quote').getDescribe().isAccessible()) {
   List<SObject> quotes = [SELECT Id, Name, QuoteId, Document FROM QuoteDocument;
}
But I need a way to detect it SOQL query.

Amit & Manoj, Thank you for replying.
Those queries will not work as we are referencing QuoteDocument directly. You can test it by excuting it in Developer Console -> Debug -> Anonymous Window.

 




 

Amit Chaudhary 8Amit Chaudhary 8
below code is working fine for me.
List<QuoteDocument> quotes = [SELECT Id, Name, QuoteId, Document FROM QuoteDocument];
System.debug('----------->'+quotes.size());
User-added image

 
Uday Sales1Uday Sales1
It works if Quotes are enabled for the organization.

If you disable Quotes using following setting:
Setup -> App Setup -> Customize -> Quotes -> Quote Settings
and you would get the following error.

Error
Uday VUday V
List<sObject> sobjList = Database.query('SELECT Id, Name, QuoteId, Document FROM QuoteDocument where QuoteId = :custom');
This was selected as the best answer
JOSE A BONILLAJOSE A BONILLA
Make sure the object is on Deploy and not in development mode.
suthanth Dksuthanth Dk
ERROR at Row:1:Column:16 sObject type 'Container Async Request' is not supported in slaesforce sandbox
I am getting this error can some one please help in resolving this error
Jonathan Crow 6Jonathan Crow 6
@suthanth Dk did you ever find an answer to your question? I am getting the exact same message.