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
Andre LuisAndre Luis 

Create new order and add products AND Add products to existing Order

Hi
I'm using salesforce REST API for web app
creating orders for an Account.
I can create the order just fine(without products)

My problem is,
add a product to the order when creating
and
Updating an existing order.

Does anyone have the correct json POST / PATCH for that ?
using v20 API and PHP btw.
MikeGillMikeGill
Are you using the PHP Toolkit or REST Api? It sounds like REST to me. Salesforce want you to use the Bulk API. if you search the boards you will find that. Maybe I wrong, I don't know.
Andre LuisAndre Luis
Tkz for the reply Mike.
Using REST API.
I'll look for the bulk api.
MikeGillMikeGill
Just a question - are you just trying to be efficient with creating the order so you are not doing separate calls? Bulk API is designed for large volume of records, if your app is creating one order plus products at a time, doesn't seem that smart to use Bulk. But if you are batching up large quantities of fully completed orders then yes Bulk API makes sense.
Andre LuisAndre Luis
Not creating large orders, one at a time.
But I get error from server saying my json is incorrect somehow, I'm following the same things I did when creating Contact / Account, and I can't get to work when creating a new Order with Products inside.
I can create the order just fine without adding product to it, if I try to put an Array to "OrderItems" I get an error. (400).
If I use v31 I get error that AccountId or EffectiveDate and other fields aren't recognized.
Andre LuisAndre Luis
Following this model -> http://developer.force.com/cookbook/recipe/interact-with-the-forcecom-rest-api-from-php