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
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
-
5,626 Points
Posted 1 year ago
Matt Davis, Employee
-
1,640 Points
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><p>{{#ShowName}}{{Name}}{{/ShowName}}</p>
</contents>
</richtext>
</components>
<resources>
<labels/>
<javascript/>
<css/>
<actionsequences uniqueid="sk-xw6-218"/>
</resources>
<styles>
<styleitem type="background" bgtype="none"/>
</styles>
</skuidpage>
Matt Sones, Champion
-
32,370 Points
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.
Otherwise, inserting directly into the html with jquery is probably your best bet.
Luzie Baumgart, Official Rep
-
4,172 Points
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}}
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}}
(Edited)
Emily Davis, Employee
-
3,612 Points
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.
Related Categories
-
Skuid on Salesforce
- 2741 Conversations
- 224 Followers
Louis Skelton
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:
At the moment when I try to do this it, of course, tries to process the merge syntax so you just end up with:
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:
Matt Davis, Employee
When it processes merge syntax, it should process {{{OpenBrackets}}}Name{{{CloseBrackets}}} => {{Name}}
Louis Skelton
Always a way!
Matt Sones, Champion