Debugging Saved Search Jobs

Because so many configuration parameters are involved, both within NetSuite and within Mitto, it is sometimes difficult to pin down the cause of saved search jobs that aren’t working as expected.

One technique is to eliminate Mitto from the picture and execute the saved search via Mitto’s Saved Search RESTlet directly from the browser. This is helpful in that it can identify user/permission problems and it displays the data returned by the NetSuite saved search verbatim in the browser.

These instructions use FireFox, though Chrome can be used in a similar manner.

  1. Get the internal id of the saved search you wish to use. This example uses a saved search for Customer records with an internal id of customsearch801.

  2. In the browser, navigate to the deployment record for the Mitto Saved Search RESTlet. Customization -> Scripting -> Script Deployments. Click view on the Mitto Saved Search RESTlet.

  3. Click the URL.

    _images/script-deployment.png

    Script Deployment Record

  4. A new window will open and an error message will be displayed.

    _images/error.png

    Error Message

  5. In the window with the error, open the developer tools inspector: Right-click -> Inspect.

  6. In the Inspector portion of the window, click Network.

  7. In the Network Inspector, click Reload.

    _images/inspector.png

    Network Inspector

  8. The same error will appear again. Scroll to the top of the network traffic. The first row will have a status of 500. This represents the GET that was issued when Reload was clicked.

  9. We will modify this request and resend it. The response will contain the first block of data from our saved search.

    1. Right-click on the first row and click Edit and Resend

    2. In the Method box, replace GET with POST.

    3. Scroll to the bottom of Request Headers and add a new line:

      Content-Type: application/json
      
    4. Click in the Request Body section and add the following JSON content:

      {
          "record_type": "Customer",
          "search_id": "customsearch801",
          "last_modified_column": "None",
          "internal_id": "1",
          "line_id": "None",
          "batch_size": "1000",
          "log_level": "DEBUG"
      }
      

      The contents of the Request Body is passed to the Mitto Saved Search RESTlet. The values control the RESTlet’s behavior. record_type and search_id must match the saved search that is to be used.

      The remaining key/value pairs are likely to be of limited use for debugging purposes; their functions are described the the job configuration documentation.

    5. Your request should look like the one below.

      _images/edit.png

      Edit and Resend

    6. Click Send. A new line will appear at the bottom of the Network Inspector. I should have a status of 200 and a Method of POST.

    7. Click the new line. In the section of the Inspector that opens on the right, click Response.

      _images/results.png

      Response

    8. The response containing JSON objects from the Mitto Saved Search will be displayed. The objects can be expanded to view their content.