Tell Skuid template NOT to process merge syntax...

Louis Skelton
edited July 22, 2019 in Questions
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!




  • Matt Davis
    Matt Davis ✭✭✭
    edited October 4, 2018
    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">
            <model id="Oppty" limit="1" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Opportunity">
                    <field id="Name"/>
                    <field id="ShowName" uionly="true" displaytype="BOOLEAN" label="ShowName" ogdisplaytype="TEXT" defaultvaluetype="fieldvalue" defaultValue="false"/>
            <basicfieldeditor showheader="true" showsavecancel="true" showerrorsinline="true" model="Oppty" uniqueid="sk-xwG-294" mode="edit">
                    <column width="50%" uniqueid="sk-xwG-290">
                            <section title="Section A" uniqueid="sk-xwG-291" collapsible="no">
                                    <field uniqueid="sk-xwJ-313" id="ShowName"/>
                    <column width="50%" uniqueid="sk-xwG-292">
                            <section title="Section B" uniqueid="sk-xwG-293">
            <richtext multiple="false" uniqueid="sk-xwK-318" model="Oppty">
            <actionsequences uniqueid="sk-xw6-218"/>
            <styleitem type="background" bgtype="none"/>

  • Louis Skelton
    edited October 4, 2018
    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:
    Please use the following merge fields when creating your document:   Opportunity Name = {{Name}}
    Account Name = {{Account.Name}}
    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:
    $("#table-of-merge-fields-for-user").html("<table>MY LIST</table>");
  • Matt Sones
    Matt Sones 💎💎💎
    edited October 4, 2018
    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.
  • Matt Davis
    Matt Davis ✭✭✭
    edited October 5, 2018
    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}}
  • Louis Skelton
    edited October 4, 2018
    Oh wow! That's a super neat idea! Thanks! :D

    Always a way!
  • Matt Sones
    Matt Sones 💎💎💎
    edited October 4, 2018
  • Luzie Baumgart
    Luzie Baumgart 🛠️ 
    edited December 7, 2018
    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}}
  • Emily Davis
    Emily Davis ✭✭✭✭
    edited July 22, 2019
    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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!