Thoughts on Netsuite PHPToolkit v2013_1

Netsuite LogoNetsuite has released their 2013_1 version of their PHPToolkit (php library for accessing Netsuite Backend API). Since I had last looked into their toolkit, the Netsuite developers have completely rewritten their toolkit, so I thought I should mention some of my thoughts on the new version:

The Good Stuff

  • Object Orientated.  The new toolkit makes much better use of objects.  Rather than one object (nsComplexObject), there are now objects for logical units like “items” or “customers”.
  • Easier to Explore: It is now easy to see what properties an object has.  You used to have to look at the webservices documentation to see what properties an object had (and what name they used).  However, now you can just look at the php object’s properties.
  • Some backwards compatibility: they created a method called setFields() which allows you to set object values via arrays like the older toolkits.  A nice touch to reduce code rewriting.
  • More Support: now there are more objects and properties accessible via the API

The Not So Good Stuff

  • Not backwards compatible: I had to rewrite almost every call to the Netsuite API.  The old methods of using the toolkit are broken.  The setFields method is nice, but is still used differently than the old toolkit.
  • setFields() fails to handle nullFieldList — Looks like a simple bug in the code (not hard to fix though).
  • Not namespaced: The toolkit defines hundreds  of objects with names like “Customer”, “Item”, and “Task”.  Chances are pretty good that at least one of these names will cause a collision. Note: the toolkit does check for existence of a class before defining their own, but that prevents the use of their class.  Namespaces would be a much cleaner solution.


Overall I would say the change is for the better.  There is still work to be done, and it would have been nice if there was more backwards computability, but overall the change is a good one.

This entry was posted in Netsuite PHPToolkit and tagged , , , . Bookmark the permalink.

2 Responses to Thoughts on Netsuite PHPToolkit v2013_1

  1. Shan G says:

    Regarding ‘setFields() fails to handle nullFieldList..’, could you please give us some solution on how to fix this? I’m having sort of issue from my saved search responses similar to this.

    Thanks in advance!

    • daniel says:

      Looking at my git history, it looks like I made the following change to NSPHPClient.php:

      Under the setFields method look for the following line (around 62?):
      if (!isset($typesmap[$fldName])) {
      and replace it with:
      if (!isset($typesmap[$fldName]) && $fldName !== ‘nullFieldList’) {

      Note, this doesn’t deal with the nullFieldList for you, it just prevents the method from throwing an error when you set values for the nullFieldList.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>