Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

It appears that Quote is a SF SObject, yet the following code renders the following error:

[SELECT Id From Quote]

sObject type 'Quote' 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.

The following code throws an NPE on the first line:

SObjectType objType = Schema.getGlobalDescribe().get('Quote');
Map<String, Schema.SObjectField> objectFields = objType.getDescribe().fields.getMap();

So what is a Quote? How do a get a list of them?

Thanks for your help :D

share|improve this question
    
Can you provide us with more information? Because query you post HAVE TO work. Is it possible that it is used in context of user who can't see this object? –  Artur Kępczyński Feb 5 at 20:36
    
I have run this query in a dev org, and in a enterprise org of one of our customers. In the dev org, the query is run from an admin account. In the enterprise org, the query is being run via the rest api (with the full access and refresh token permissions). The api version is 29.0. –  edgartheunready Feb 5 at 20:39
    
In both is returning error? How about answer/question from @sfdc_ninja? –  Artur Kępczyński Feb 5 at 20:43
add comment

1 Answer 1

up vote 6 down vote accepted

It may seem simple and I'm sorry if I'm wrong, but I suspect you haven't enabled quotes for your org. It is not enabled by default, you have to manually do this step to use quotes.

Setup -> Customize -> Quotes -> Settings -> Enable Quotes

enter image description here

share|improve this answer
    
That might be it. I'll look into that. (I am new to SF, so no answer is too basic. thank you) –  edgartheunready Feb 5 at 20:42
    
Following those steps allowed me to run the following line of apex. List<SObject> items = [SELECT Id From Quote]; Thanks for your help. I will have to follow up with the customer to make sure they are talking about Quotes, and not some other SObject like Opportunity. –  edgartheunready Feb 5 at 20:52
    
Awesome. Glad to help :) –  sfdc_ninja Feb 5 at 20:54
    
Looks like my customer was referring to Opportunities when they said Quotes. –  edgartheunready Feb 6 at 18:53
    
I figured as much. Would have been odd if they were asking you query something they hadn't even activated :) –  sfdc_ninja Feb 6 at 18:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.