Tell Skuid template NOT to process merge syntax...

I feel bad even asking this one…

But is it possible to tell Skuid to not process merge syntax in a particular template? We’re building a mail-merge tool in Skuid an want to provide the user with a list of merge fields they can use in the template - but of course Skuid just tries to merge the fields in the list!

Annoying question - I know!

Cheers!

Louis

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>&amp;lt;p&amp;gt;{{#ShowName}}{{Name}}{{/ShowName}}&amp;lt;/p&amp;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&#46;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")&#46;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! :smiley:

Always a way!

Brilliant!

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.