Handle bar error with nested elements
Hi Guys,
Having an issue with simply iterating over source JSON. On handlebar editor the expression evaluate correctly and renders the result as expected. See the screenshot link below.
https://www.screencast.com/t/BpFz3Jp9M0
Running the flow gives the following error.
Code | Message | ||
---|---|---|---|
invalid_handle_bar_expression |
"Could not compile handle bar \"{{{result.styles[*].item_number}}}\" because \"Parse error on line 1:\n{{{result.styles[*].item_numbe\n----------^\nExpecting 'ID', got 'INVALID'\" .Please correct and retry"
|
0
Comments
Hello, you just have to use a "." before the star syntax: {{{result.styles.[*].item_number}}}
Hi Orion Abrams,
Thank you for the response. But I am not sure how do I get that "." to be part of the final expression. I am using AFE Ver 2.0.
Here are the "Resources available for your handlebars template":
Here is my handle bar template:
On preview the expression works fine and gives the following result.
However, when this expression is evaluated at runtime (when the flow runs), it gives the following error.
Could not compile handle bar \"{{{result.styles[*].item_number}}}\" because \"Parse error on line 1:\n {{{result.styles[*].item_numbe\n----------^\nExpecting 'ID', got 'INVALID'\" .Please correct and retry"
Also, I cannot find any documentation on using AFE Ver 1.0. Otherwise, I would have tried that to see if this issue is specific to new constructs in version 2.0.
Hi Boss,
Do you have any mappings on this import step along with the handlebars in the body builder here? I think you may have a normal mapping using {{{result.styles[*].item_number}}} , hence the error. I don't think your each expression should convert to star syntax in the back-end. Can you please check you don't have any normal mappings for this step and delete them if so and retry?
Hi Orion Abrams,
Yes, I do. However, this handlebar expression is executing on export step for success call back (I have a success API callback to my custom back end to mark successful export of the data).
https://www.screencast.com/t/qobSnJ31a (shows the export step configuration)
I still followed your recommendation and removed the {{result.styles[*].item_number}} import mapping and ran the flow again to get the same error message. So, I am fairly certain that the issue is not with the import mapping.
May be I shall consider a different approach and you can guide me how to do that. So, ultimately all I want to do is to export records from our custom PHP app and on success callback (right after export step) send the record identifiers (ids) or "item numbers" back as HTTP request body. On the next step in the flow, I will map the export fields to import fields in NetSuite and import the records in NetSuite.
Let me know if I shall share the flow definition screenshot with you.
Thank you for your help. Really appreciate it.
Hi Boss,
Can you please log a support ticket for this within integrator.io? I can't help here further without seeing all the parts of the flow and errors dashboard. I don't think an #each statement would ever be converted to star syntax, so I think you may still have an import mapping using "result.styles[*]." causing the error. Good luck!
Hi Orion Abrams,
Thanks a lot for your help. Turned out that the issue was in import where I was doing an expression to check for existing record in import application. Your hint to use a "." helped solve the issue. The export handlebar expression was working fine.
One thing I noticed is that the use of "." is not consistent anymore. So when using a field in an expression I had to use the "." before [ ] while using the field in #Compare expression integrator automatically added a "." causing the expression to fail as there were two ".." before [ ] in the resulting expression. Anyways, Thanks again for your help.
Please sign in to leave a comment.