Skip to main content

Lookup data from Handlebars template

Comments

5 comments

  • Orion Abrams Technical Implementation Consultant

    Hi Steve,

    There is no way currently to add custom helpers. I am unsure exactly what your output should be here, but would this handlebar work for you?

    {{#each config}}
    <{{name}}>{{value}}</{{name}}>
    {{/each}}

    0
  • Steve Klett Channel Partner
    Awesome Follow-up
    Engaged
    Celigo University Level 2: Seasoned

    Thanks for the reply Orion.

    I updated my post to so correct a missing parameter in my "find" helper examples, I also added a section on what I would expect to have returned. Your example will enumerate an array, I'm not looking for that, I want to find an object in an array and use one of it's properties in my template.

    0
  • Orion Abrams Technical Implementation Consultant

    Hi Steve, if that is the case, where you can't just take out the config XML elements from your template and list all the elements in order of the config array using the #each helper, which would make a this output:

    <supplierSKUId>PW</supplierSKUId>
    <UOMQualifierID>UOMQID</UOMQualifierID>

    If the above doesn't work for you, assuming this is for a custom flow and not an Integration App, you can add a JavaScript preMap hook to the import step to separate out the objects into the config array into their own key/value pairs, and use those directly in each corresponding element without a handlebar helper. There currently is no way to add a custom handlebar helper.

    0
  • Steve Klett Channel Partner
    Awesome Follow-up
    Engaged
    Celigo University Level 2: Seasoned

    Hi Orion,

    Thank you for the reply.

    I don't want to do this in script, I'm looking for a template only solution. Hopefully my post here will get some attention and there can be consideration for adding this helper or something like it.

     

    0
  • Orion Abrams Technical Implementation Consultant

    I believe these built-in helpers would also work for your use-case without needing a custom one, but I do also hope that at one point custom helpers will be configurable.

    <supplierSKUId>{{#each config}}{{#compare name '==' 'supplierSKUId'}}{{value}}{{/compare}}{{/each}}</supplierSKUId>
    <UOMQualifierID>{{#each config}}{{#compare name '==' 'UOMQualifierID'}}{{value}}{{/compare}}{{/each}}</UOMQualifierID>

    0

Please sign in to leave a comment.