1

Below is the error message I get when trying to retrieve a list of products from Salesforce through a SOQL via the SFRestRequest, When I replace Product with Account in the query string I get results.

request:didFailLoadWithError: Error Domain=com.salesforce.RestAPI.ErrorDomain Code=999 "The operation couldn’t be completed. (com.salesforce.RestAPI.ErrorDomain error 999.)" UserInfo=0x175afa00 {message=sObject type 'Product' is not supported., errorCode=INVALID_TYPE}

I wasn't aware of a limitation of what standard objects that could be worked with through SOQL and the RestAPI. below is the syntax for my query:

    SFRestRequest *request = [[SFRestAPI sharedInstance] requestForQuery:@"SELECT Id, Name FROM Product"];
[[SFRestAPI sharedInstance] send:request delegate:self];
3

Are you looking for the Product2 sObject?

If you're on OS X, SoqlXplorer is a great admin tool. You should familiarise yourself with the schemas in the orgs in which you are working. :P

| improve this answer | |
  • Bingo! I will check that ... – Bart Sep 15 '13 at 22:30
  • Jonathan, thanks for your answer, I replaced Product with Product2 and it worked like a dream AND I checked out that tool SOQLXplorer, it is just what I have been looking for - much appreciated! (Yes, I do familiarise myself with everyschema in every org I work in :P ) – Bart Sep 16 '13 at 8:01
1

you are receiving error in response, there can be two possible reasons for this:

  • You are querying a production instance of salesforce organization

  • Or your logged in user profile don't have permission enabled for Product sObject or Product is not setup for organization.

| improve this answer | |
  • great, I've checked the user and they are a System Admin, also they are logging into the production instance, but this is a fundamental prerequisite or did I read your answer incorrectly? – Bart Sep 15 '13 at 17:25
  • Thats default behaviour and basically salesforce is against accessing sObjects data from API. Production environment don't allow development. You have to do this with sandbox or developer. @Bartley – Ashwani Sep 15 '13 at 17:30
  • I'm at a loss here, do you have any idea how come I can get the data from the Accounts object? – Bart Sep 15 '13 at 18:21
  • I found a Salesforce document defining sObjects. apparently Rest API request to Product (and Pricebook for that matter) get refused. One should use Product2 or Pricebook2 instead. I will try this. These sObjects (along with many other sObjects) are not available via Rest API requests via Force.com – Bart Sep 15 '13 at 22:28
  • Product is a classic table used with old API integrations (very old API integrations); no new code should ever use it. For compatibility purposes, you will always use Product2 and Pricebook2 instead. – sfdcfox Sep 16 '13 at 0:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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