Skip to main content

A template marked with “Do not run template on each row” is not rendering merged fields.


Steps to reproduce:


  1. Create a new detail page for account

  2. Add a template to the page

  3. Mark the template “Do not run template on each row”

  4. Preview page choosing an account

Actual Result

Template area contains non-merged values but not any fields that were merged (e.g. {{Name}})


Expected Result

Template should contain merged fields


Notes:


  1. The sample page is constrained to a single record in Account model based on url parameter id. However, if you remove the Max Record # restriction (or just increase it) and eliminate the condition for id, the template still does not render properly.

  2. If you disable the “Do Not run template on each row” property, the output of the template is correct.

Sample XML


<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
<model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account" doclone="" type="">
<fields>
<field id="Name"/>
<field id="CreatedDate"/>
</fields>
<conditions>
<condition type="param" value="id" field="Id" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
</conditions>
<actions/>
</model>
</models>
<components>
<template multiple="true" model="Account" allowhtml="true">
<contents>Account Name: {{Name}}</contents>
</template>
<basicfieldeditor showsavecancel="false" showheader="true" model="Account" mode="read" buttonposition="" layout="">
<columns>
<column width="100%">
<sections>
<section title="Basics">
<fields>
<field id="Name"/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
</skuidpage>

Hi Barry,

This is by design — what “Do Not Run Template on Each Row” is saying is “perform a merge in Model context, rather than Row context”. With this property UN-checked, the merge template is parsed in Row context for each row in the Model.

Merges done in “Model” context can only access field values on that Model by explicitly specifying a particular row to access via the .data attribute on a particular row, e.g. {{Model.data.0.Name}}. 

Now that you are posting this, I can see how you might think that the assumed behavior would be to run in Row context always, but if “Do not run template on each row” is checked, to run it on just the first row in the Model… we might need to adjust the wording of this property’s name.  



Hi Zach -

Thanks for the info, makes perfect sense.

It’s been a long time since I had to toggle this property but I seem to recall that having it checked would only run against the first row (in row context) and apply row merge syntax although I’m probably just not remembering correctly and might have used model merge syntax.  Either way, the way you describe it’s intended purpose gives the flexibility I’m looking for so it’s an easy adjustment on the page.

Regarding the name, I’d agree that something like “Merge using Model Context” or “Do not apply row context” or something like that might provide better clarity on intended functionality.  That said, the tooltip help clearly states what you described and I should have noticed that 🙂

Thanks again!


Yeah we debated for a while about the name, worrying that throwing around the words “Model context” and “row context” might completely confuse first-time Skuid users… tough call.


I felt similarly when I wrote my previous post, didn’t like the use of the word “Model Context” as it isn’t intuitive either for new users.  Couldn’t come up with anything better though lol

Here’s a couple of other ideas if you guys decide it’s worth changing:

1) “Do not run Template on rows” - Very similar to the current wording but removes the word “each” as “each” is what is a little ambiguous since it could “imply” that it’s not each but it might be “some”

2) Use something with “model context” or “row context” but put a “what’s this?” link next to it that takes the user to the docs for definition of what model/row context is.


Hey Skuid! I just ran into the same issue. Thanks for the clear answer. I like Barry’s “Do not run Template on rows” suggestion.


Looks like I should have just read the tooltip… 😉


Don’t worry. Tooltip text is never read. 


Reply