Trouble with Compare

Here's my original payload:

"items": [
    {
      "returnReasonID": "changed-my-mind",
      "returnReasonNote": "",
      "refundType": "store-credit"
    }
  ]

These compare expressions all fail:

{{#each items[*].refundType}}{{#compare this.refundType "==" "store-credit"}}True{{/compare}}{{/each}}

{{#compare items[*].refundType "==" "store-credit"}}True{{else}}{{/compare}}

{{#compare $.items[*].refundType "==" "store-credit"}}True{{else}}null{{/compare}}

They're all attempting the same evaluation of refundType.

They fail in different ways:

Failed to generate field value from template: {{#compare $.items[*].refundType "==" "store-credit"}}True{{else}}null{{/compare}}. Details: Parse error on line 1: {{#compare $.items[*].refundType -------------^ Expecting 'ID', got 'INVALID'.

Before someone says it's an issue with wildcards, these similar expressions (used in different flows!) all evaluate properly:

{{#compare $.order.items[*].monogram_color "!=" NULL}}{{$.order.items[*].monogram_color}}-{{$.order.items[*].monogram_size}}{{else}}null{{/compare}}

{{#each line_items[*].properties}}{{#compare this.name "==" "__is_preorder"}}{{#compare this.value "==" "true"}}True{{/compare}}{{/compare}}{{/each}}

{{#compare line_items[*].sku "!=" "Digital Gift Card"}}-1{{/compare}}

I'm ripping my hair out.

0

Comments

3 comments
Date Votes
  • Justin Hughes this one is working for me

    {{#compare items[*].refundType "==" "store-credit"}}True{{else}}False{{/compare}}

     

    What error do you get for this one? Also, what system are you going to with this?

    0
  • Hi Tyler Lamparter, thanks for your response. This is a custom flow going from Happy Returns into Netsuite. When I run your particular flavor I'm getting:

    Failed to generate field value from template: {{#compare items[*].refundType "==" "store-credit"}}True{{else}}False{{/compare}}. Details: Parse error on line 1: {{#compare items[*].refundType -----------^ Expecting 'CLOSE_RAW_BLOCK', 'CLOSE', 'CLOSE_UNESCAPED', 'OPEN_SEXPR', 'CLOSE_SEXPR', 'ID', 'OPEN_BLOCK_PARAMS', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', 'SEP', got 'INVALID'.
    0
  • Justin Hughes when you are on the mapper for NetSuite, does it preview correctly? Can you screenshot aht setup?

    0

Please sign in to leave a comment.

 

Didn't find what you were looking for?

New post