0

I have been asked to design some new forms that create Orders in Salesforce. To achieve this I call the webservices often using Query. For these new forms that are related to Ordering I had hoped to Query the Product2/PriceBook2/PriceBookEntry objects as this is where the data is stored.

I am currently testing via hurl.it and the URL to call (with the correct authorisation) is simplified to this query:

https://XXXX.salesforce.com/services/data/v32.0/query?q=SELECT+Id+FROM+Product2

Which returns the error code:

INVALID_TYPE

The query is simply:

SELECT Id FROM Product2

This works in the developer console.The user does have activate orders and edit activate order permission.

Can anyone confirm if it is simple NOT Possible to query these objects in this fashion? What is an alternative (this is simple...enough for me).?

If it is not possible to query, I am able to hard code the products onto the form I am developing (they don't change often and there aren't many) and then create the Order/Line Items directly via the Web Service (including Activating it) - I haven't got this far but I hope it is all possible.

  • by any chance is product to a custom object, maybe you need to use the API name -> Product2__c in the query – glls Jul 21 '17 at 12:05
  • Hi, I am afraid it is the standard objects. The query: SELECT Id FROM Product2 works and returns what I expect if queried either via WorkBench OR the developer console. Thanks. – n34_panda Jul 21 '17 at 12:11
  • what JS library are you using in the app to call SF ? – glls Jul 21 '17 at 12:12
  • I should emphasise that at the minute I am actually testing via hurl.it. The IDE isn't playing a part yet (I will edit the question to remove that - it is unnecessary (question now edited). – n34_panda Jul 21 '17 at 12:14
  • Its working - I missed something obvious! See answer - Thanks for your time and help. – n34_panda Jul 21 '17 at 12:18
0

It was permissions:

The API user I was using simply record Read access to Products and Price Books.

I would usually delete this question to avoid embarrassment but too late for that.

| improve this answer | |
  • might as well accept your own answer =P – glls Jul 23 '17 at 7:19
  • 1
    Yeah I know - 2 day restriction on that though so I couldn't until now. – n34_panda Jul 23 '17 at 17:34

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.