-
Notifications
You must be signed in to change notification settings - Fork 36
JSON examples for subrecords, sublists, etc. #14
Comments
@JamesChristie care to chime in? I believe Netsuite interaction is complex in any instance, so it's hard to provide a generic data structure format without exposing some of our custom setup. |
I'll update the README with example structure of request formatted as valid JSON as opposed to the tree structure we're using at the moment. |
I'm faily new with Netsuite and their SuiteScript API and I want to change our current soap web services into restlets calls. I really like this project but since I'm not familiar with it, I would love some guidance. I got the initialize and load to work. By the way, Initialize doesn't work on NetSuite for me. I had to switch it to nlapiCreateRecord. My problem right now is with the sales order upsert. Take for example the following request body: [{ And I can't get it to work. I'm assume it's something wrong with my body. The closest error to get it to work is an error: "TypeError: Cannot call method "setFieldValue" of undefined (netsuite_toolkit.js#90)", and actually with this body, just like it is, I do get a "success:true", but no changes to the data. Thank you! |
I finally was able to get the debugging working. Through that I was able to get my body: And... found a bug on Upsert.js. In UpsertRequest.prototype.loadOrInitializeRecord(), the record object is assigned to either the results of loadRecord or initializeRecord, and nothing is returned... however, in UpsertRequest.prototype.execute(), the record object is assigned to whatever the loadOrInitializeRecord returns, which is null. I apolize if I should've created another issue for this. I don't have the dev branch setup yet so I can't make code changes, but I just wanted to point it to you guys. Thank you for this awesome project! |
I have a real world example, I needed to update the quantity of an item of a sales order. Here's the body I came with: The important thing for me was to look for the elements expected in sublists.... it needs the name (item, salesteam, etc), the action to do with the item: "create, update" and the way you find the item that needs to be updated, either by index (starting with 1, row-based) or by match. |
@apbit what did you do about the bug you found in Upsert.js? Here's my body. I'm assuming I don't need the empty sublists object, but just put it there to make sure.. I can't seem to get my scripts showing up in the Netsuite Debugger so this is a slow and frustrating process.
|
I got the debugger working and found the code in upstream.js should look like this:
I'm still getting the following error, even though the record gets updated - I'm trying to figure out what the issue is but no luck so far.
|
Another thing I changed was this method: You need to switch the order of field_name and index in the parameters list. I believe that your body also needs to indicate sublists as an array: I think that's all that I did different, besides using "createRecord" like you indicated. Regards! |
Thanks a lot for your help on this @apbitThe whole netsuite ecosystem is pretty daunting at first On Fri, Mar 21, 2014 at 11:47 PM, apbit [email protected] wrote:
|
I still use this amazing project, so I thought I would post an example of the json that I am sending to Netsuite via python to create new sales orders. { I will use this to pickup a csv file, loop through all the rows and generate the json to send to netsuite to create sales orders. Seems to work OK for my purposes. |
I'm just starting to learn the complexity of NetSuite's domain model. We're struggling to upsert a complex object (in our case, a PurchaseOrder) and could use some real examples of inserting a complex object including sublists with subrecords.
You do have some abstract documentation on the request structure but it's difficult for us to map that onto a real world example.
The text was updated successfully, but these errors were encountered: