Skip to main content

Using Import Filter on step after Lookup

Comments

3 comments

  • Tyler Lamparter Senior Solutions Consultant
    Answer Pro
    Celigo University Level 4: Legendary

    Hi Rob Riccio, it's not currently possible to filter on fields within flow branching within an array without using some javascript, so you were on the right path. On your lookup step, where you are getting the transaction data, will you potentially have multiple transactions for a single record lookup? I assume if you are looking up based on order number, then you could have multiple transactions tied to it and therefore have multiple records returned for a single order. If that's the case, then the array in result mapping is the right choice here and you can skip to the next paragraph. If, however, you will only ever get 1 result from the lookup (only 1 transaction for whatever you are looking up), then you could change your result mapping to be data.0.field1, data.0.field2, etc.. By doing that, you wouldn't have the array and then could use the UI branch filtering.

     

    If you will have multiple transactions returned from the lookup for a single record, then could each transaction within the array have a different source? For example, could the first object in the array have a source of "subscription contract" and the second object have a source of "sample sample"? If so, would you need to process each object within the array on it's own or just the first object is the master?

     

    As for why your javascript isn't working, you need to specify your array position within your if statement. Here is a screenshot and update code block. Hope this helps!

     

    function branching (options) {
      if (options.record.SFY_data[0].SFY_source_name === "Subscription Contract")
      return [0]
      else if(options.record.SFY_data[0].SFY_source_name === "999999")
      return [1]
      else
      return [2]
    }
    1
  • Rob Riccio

    Hi Tyler,

    Thank you; I came to the same conclusion myself this morning by process of elimination, and your answer certainly would have helped if I hadn't!   Just checking - when you said:

    If so, would you need to process each object within the array on it's own or just the first object is the master?

    I think if each on its own: 

      if (options.record.SFY_data[*].SFY_source_name

    and if the first is the master, like you showed in your example: 

      if (options.record.SFY_data[0].SFY_source_name

    is that right?

    0
  • Tyler Lamparter Senior Solutions Consultant
    Answer Pro
    Celigo University Level 4: Legendary

    Rob Riccio what is the overall goal of this flow so I can maybe better help with suggestions?

     

    For flow branching, it's processing the singular record, not the child objects within your SFY_data array. You could loop through each object within the transaction array, but you ultimately still need a single outcome. For example, if you had 10 transactions within that array, and each had a different source, you would need to figure out what branch to send the main record. Does that make sense?

     

    If I knew what exactly you were trying to accomplish I could suggest a few things:

    • You may not need flow branching and instead maybe just need an import step, set to one-to-many, then map the source to your destination.
    • You may need another flow to string with this one where you send each individual transactions, then have branching logic there.
    0

Please sign in to leave a comment.