I may not be fully clear on the use case, but it sounds like something you can do with UI fields and conditional merge syntax. For each optional field you want them to be able to select, you could have a UI only checkbox that the user selects to include or not include the field. Then in your template, you have {{#checkbox}}{{field}}{{/checkbox}}. This says to only show the field if the checkbox is true. Here’s a quick example of what I’m thinking:
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
<models>
<model id="Oppty" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Opportunity">
<fields>
<field id="Name"/>
<field id="ShowName" uionly="true" displaytype="BOOLEAN" label="ShowName" ogdisplaytype="TEXT" defaultvaluetype="fieldvalue" defaultValue="false"/>
</fields>
<conditions/>
<actions/>
</model>
</models>
<components>
<basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Oppty" uniqueid="sk-xwG-294" mode="edit">
<columns>
<column width="50%" uniqueid="sk-xwG-290">
<sections>
<section title="Section A" uniqueid="sk-xwG-291" collapsible="no">
<fields>
<field uniqueid="sk-xwJ-313" id="ShowName"/>
</fields>
</section>
</sections>
</column>
<column width="50%" uniqueid="sk-xwG-292">
<sections>
<section title="Section B" uniqueid="sk-xwG-293">
<fields/>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
<richtext multiple="false" uniqueid="sk-xwK-318" model="Oppty">
<contents>&lt;p&gt;{{#ShowName}}{{Name}}{{/ShowName}}&lt;/p&gt;
</contents>
</richtext>
</components>
<resources>
<labels/>
<javascript/>
<css/>
<actionsequences uniqueid="sk-xw6-218"/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>
Hey Matt, thank you but I think I probably didn’t explain myself very clearly. What I’d like to do is have merge syntax written on the page (in a Template component) but not actually processed by skuid (i.e. it just shows the field name in the curly braces). So it’d look like this:
Here is my template content. Here is a {{merge_field}}. The merge field is shown with the curly braces and is not processed by Skuid.I can then give the user a list of merge fields which they can then use when creating a mailmerge templates for generating pdf letters. E.g:<br alt="" name="" rel="" target="" title="" type="" value="" /><pre alt="" name="" rel="" target="" title="" type="" value="">Please use the following merge fields when creating your document: Opportunity Name = {{Name}}<br alt="" name="" rel="" target="" title="" type="" value="" />Account Name = {{Account.Name}}<br alt="" name="" rel="" target="" title="" type="" value="" />Date = {{CloseDate}}
At the moment when I try to do this it, of course, tries to process the merge syntax so you just end up with:
Opportunity Name =
Account Name =
Date =I think I can probably just use javascript to insert the information which then won't be processed by Skuid's mailmerge api on render, e.g. via:<br alt="" name="" rel="" target="" title="" type="" value="" /><pre alt="" name="" rel="" target="" title="" type="" value="">$("#table-of-merge-fields-for-user").html("<table>MY LIST</table>");
Right. Is there an ‘escape’ key to ask skuid not to process the merge syntax?
Otherwise, inserting directly into the html with jquery is probably your best bet.
Gotcha, my bad on the misunderstanding. I ran into something like this before, and my workaround was a little funny but what I did was insert the brackets via merge syntax. So I created UI only fields “OpenBrackets” (default to {{ ) and “CloseBrackets” (default to }} ). Then in your list have Opportunity Name = {{{OpenBrackets}}}Name{{{CloseBrackets}}}.
When it processes merge syntax, it should process {{{OpenBrackets}}}Name{{{CloseBrackets}}} => {{Name}}
Oh wow! That’s a super neat idea! Thanks!
Always a way!
For others experiencing this issue, this is the idea that Matt Davis posted in the thread above:
I created UI only fields “OpenBrackets” (default to {{ ) and “CloseBrackets” (default to }} ). Then in your list have Opportunity Name = {{{OpenBrackets}}}Name{{{CloseBrackets}}}.
When it processes merge syntax, it should process
{{{OpenBrackets}}}Name{{{CloseBrackets}}} => {{Name}}
Just another comment here: We’d love to add some kind of “escape” key (like Matt Sones mentioned) at some point, to support including curly braces in a template without having Skuid actually perform a merge on those braces. It’s a great idea, and there are other use cases for it. I’ll add it to our list of product improvements.