Forum Discussion

spitfirect1's avatar
spitfirect1
New Contributor II
5 years ago

NetSuite Item Fulfillment

Hi Team,

I am working with a pipeline to grab a Item Fulfillment record under one subsidiary and then transitioning that IF to a new IF in the other. It is a 1 for 1 transaction on our side, so the data that we pull will be the same as the data input under the new company. That being said I continue run into the error below. I will post my mapping as well. I have tried a few different things and still seem to cum up short on this one and would love some insight.

Here is the mapping currently.

35 Replies

  • spitfirect1's avatar
    spitfirect1
    New Contributor II

    Seems like this might be the solution however I am running into one error right now with the Inventory Detail. Any insight?

    here is how the mapper looks

    here is the fill truncated last line

    $inventoryDetail.inventoryAssignmentList.inventoryAssignment[*].issueInventoryNumber.name

    • ptaylor's avatar
      ptaylor
      Employee

      Sorry, I’m not seeing inventoryDetail anywhere. What is that associated with?

  • spitfirect1's avatar
    spitfirect1
    New Contributor II

    Inventory Detail shows up on your IF when you have Serial/Lot Numbers turned on and have Advance Inventory Feature enabled. This is to define, Bin, Serial # and quantity when you ship. We are a manufacture with serialized inventory so therefore the ‘Inventory Detail’ box is on all our transactions.

    • ptaylor's avatar
      ptaylor
      Employee

      Hmm, I see. I don’t know how easy it would be for me to test that. But from the error you got, it looks like that info wasn’t available for this line item, or at least not where you looked for it.

      • ptaylor's avatar
        ptaylor
        Employee

        “Expression worked for 6 previous documents”, but was missing on the 7th. You might need to use object.get(field, defaultValue) to return an object with the right structure when there is no value present.

        Also, it looks like the inventoryDetail, when present, contains an array (InventoryAssignmentList/inventoryAssignment). You might need to set up another Mapper with its Mapping Root set to that array to map the individual elements. You might also need another sl.ensureArray to handle a result that only contains one item, since it won’t be an array.

  • spitfirect1's avatar
    spitfirect1
    New Contributor II

    So I went back to the root mapper and added the inventory detail. See below. However it seems that I am still coming up with an error. Interestingly if I do not add the inventory detail it creates the record in NS but only places the IF as ‘packed’. I have to fill out the detail in order to mark it shipped.

    jsonPath($, “$record.itemList.item[].inventoryDetail.inventoryAssignmentList.inventoryAssignment[].issueInventoryNumber.name”)

    sl.ensureArray(jsonPath($, “[‘soapenv:Body’].getResponse.readResponse.record[‘tranSales:itemList’][‘tranSales:item’][*][‘tranSales:inventoryDetail’][‘platformCommon:inventoryAssignmentList’][‘platformCommon:inventoryAssignment’][‘platformCommon:issueInventoryNumber’]”))

    • ptaylor's avatar
      ptaylor
      Employee

      You can’t use an expression like that for a Target Path. The Target Path should just be a JSON path of where to map the value in the target schema.

    • spitfirect1's avatar
      spitfirect1
      New Contributor II

      So the root is bring it all in…

      Just seems to not want to itemize it on the target path.

      • ptaylor's avatar
        ptaylor
        Employee

        Since you’re dealing with a list/array, you need to use another Mapper with its Mapping Root set to the inventoryAssignment array.

  • spitfirect1's avatar
    spitfirect1
    New Contributor II

    I am still seeming to have issues getting the Inventory detail in. i have added the additional mapper at the inventory Assignment level, however when I go to run it gives an error that no items are added. You will see on the EU Items mapper we get all the inventory detail on the input data but the output turns it to ‘null’, seemingly giving me the error. Is the detail mapper in the wrong spot in the pipeline? Let me know as we are so close on this!!

    Truncated last line: sl.ensureArray($.get([‘tranSales:inventoryDetail’]))

    • ptaylor's avatar
      ptaylor
      Employee

      Sorry, I just saw your last reply.

      I think I see the problem. The inventoryDetail is not supposed to be an array. It can be null, but if it’s not, it should be an object. The object contains an array at the subpath inventoryAssignmentList.inventoryAssignment. So I think you need to handle it being null by providing a default value that adheres to that structure, using an expression like this:

      sl.ensureArray($.get(‘tranSales:inventoryDetail’, {'inventoryAssignmentList': {'inventoryAssignment': []}))

      I’m not certain that’s right, but give it a shot.

      • spitfirect1's avatar
        spitfirect1
        New Contributor II

        Patrick,

        So I have tried this and I am still getting an error that it worked for 1 document not failed on 2 and others. I spoke with your team yesterday and I was advised to check the ‘Null - Safe Mode’ box to base items that return null in the code. This seem to work and I was getting a ‘empty string’ error at the create function. In attempting to research this I found that when my inventory detail reaches an array quantity, (so a quantity more than 1) then it passes the value as ‘Null’ but if the value is just 1 it works down the list and provides all the data I need. I attempted to use the sl.ensureArray([‘platformCommon:quantity’]) and I got new error that it did not like the number format on the first line of [“1.0”]. I think if we find a solution for the Array values then we will be able to create. I have provided the picture if when the values are passed as Null with the safe mode checked on the inventory detail mapper.

        Quantity 1

        Quantity 4

        Error


        Detail Error Log: