Skip to main content

Multiple imports from one source (NetSuite)

Comments

10 comments

  • Stephen Brandt Documentation Manager Community moderator
    Engaged
    Great Answer
    Top Contributor
    Celigo University Level 3: Master

    Hi, Craig Silk.

    > Is there a way I can do two separate imports...?

    There might be other ways to modify the records or apply logic, but the answer to your question is yes. See Import filters for more information. Here's the important part for this scenario: 

    > If there are other downstream [imports], the flow continues to process all records regardless of whether or not they met the import filter criteria.

    That's unlike an export filter, in which records filtered out are unavailable for later processing. 

    0
  • Craig Silk

    I've used filtering a lot for this flow because there are 5 imports in this flow but I can't see how to use filters to make this work.

    0
  • Matt Graney Chief Product Officer
    Answer Pro
    Top Contributor

    > This can't be on one item receipt because the JSON has split the same item into multiple lines depending on the 'good' or 'damaged' status of the item.

    Would it help to refactor the JSON in a JS hook so that it consolidates the items into a single line like this instead?

    {
       "goods": {
          "sku": "33560",
          "goodQty": 1,
          "damagedQty": 2
       }
    }
    0
  • Craig Silk

    That would merge the items back into one line which doesn't work for the fulfilment record. The NS fulfilment record requires that you specify restock or no-restock on a line item basis so I believe all non-restock items (damaged) would need to be on a separate fulfilment record.

    I think Celigo will need to import all the good items in one import then all the damaged goods in another import. The warehouse only sends one JSON message so this all needs to be on one webhook / flow.

    I've got a solution where Celigo writes everything to a custom NS record then a SuiteScript can process the fulfilment record. This is by far the easier option for us but means we're reducing the value of Celigo by bypassing some of its functionality.

    Here's my SuiteScript solution / idea:

    0
  • Matt Graney Chief Product Officer
    Answer Pro
    Top Contributor

    Ah, ok. Then perhaps you need to set this option in your Item Receipt import:

    By setting "One to many" to "Yes", and then setting "Path to many" to point to your "goods" array, there will be one import per array element (ie. in your case, separate ItemReceipts for good and damaged stock). Note that will change your mapping a bit because the "root" for mapping will be the elements in the "goods" array, and you will need to reference elements above "goods" in the JSON hierarchy using {{_PARENT.fieldName}} or {{../fieldName}} notation.

    It's a little tricky to have these exchanges here sometimes, so please consider attending office hours (see https://docs.celigo.com/hc/en-us/articles/360045798291-Which-office-hours-should-I-attend-) or logging a ticket (as I've seen you've done for other topics).

    0
  • Craig Silk

    I'm not too familiar with the 'one to many' setting but thought it might create one receipt per line when what we need is two receipts; one for all the good items and one for all the damaged items. I'll play around with that setting in sandbox and see what I can get it to do. 

    Thanks

    0
  • Matt Graney Chief Product Officer
    Answer Pro
    Top Contributor

    If you could share a more complete payload we might be able to advise you better. Anyway, please keep us posted on your progress.

    0
  • Craig Silk

    The payload I've included covers the whole usecase, any more and it just gets too complex to communicate and test. I'll let you know how enable that setting goes but my fear is that it will create one receipt for every item. I'll let you know.

    0
  • Kelly Izer

    Craig,

         I agree with your statement that "Celigo will need to import all the good items in one import then all the damaged goods in another import"

    So what I would suggest is that you create 2 item receipts imports but in the mapping you will need to write a compare statement on the items to only use the lines that match your criteria.

    Here is an example (note it would have to be tweaked for your exact use case, this is just an example)

     

    0
  • Craig Silk

    Hi Kelly,

    That sounds promising. I guess that conditional statement only imports 'good' items then the next import in the flow could do the same but change the condition to look for 'damaged'.

    I'll try and implement this in the sandbox environment.

    Thanks

    0

Please sign in to leave a comment.