2022.2

Table Of Contents
let html = ''
let policydata = record.tables.Policy
for (var i=0; i < policydata.length; i++) {
let templateName = 'snippets/' + policydata[i].fields['snippetName'] + '.hbs'
html += Handlebars.render( templateName, policydata[i] )
}
results.replaceWith( html );
Partials
PartialsarenormalHandlebarstemplatesthatmaybecalleddirectlybyothertemplates.Thistopic
explainshowtoworkwithHandlebarspartialsinOLConnect.
InformationaboutHandlebarstemplates(snippets)inOLConnectcanbefoundinthetopics"Handle-
barstemplates"onpage774.
Note: TheinformationinthisOnlineHelpfocusesontheimplementationofHandlebarsinOL
Connect.ForgeneralinformationaboutHandlebarsandhowtouseit,seethefollowingweb
sites:https://handlebarsjs.com/andhttps://devdocs.io/handlebars.
Creatingapartial
AnyHandlebarstemplate,includingremoteHandlebarstemplates,canbeusedasapartialinaHandle-
barstemplate(snippet)inOLConnect.
TocreateapartialinanOLConnecttemplate,simplycreateanewHandlebarstemplate;see"Creating
aHandlebarstemplate"onpage775.
Tip: TokeepanoverviewyoucouldgroupthepartialsinasubfolderoftheSnippetsfolderon
theResourcespane.
Howtoregisterapartial
Itisnotmandatorytoregisterapartial,butitcanbeuseful,forexampleifyouwanttoworkwith
dynamicpartials.RegisteredpartialscanbereferredtoinHandlebarsexpressionsandfunctionsbythe
specifiedname;see"Usingaregisteredpartialinatemplate"onthefacingpage.
Toregisterapartial,usethefollowingfunctioninascript:Handlebars.registerPartial('partialName',
'template')(fordetailssee:"HandlebarsAPI"onpage780).
Forexample,thislineofcoderegistersatemplate(clauses.hbs)asapartialwiththename'clauses':
Handlebars.registerPartial('clauses', 'snippets/partials/clauses.hbs');
Tip: PartialsregisteredinaControlScriptwillbeavailableinallstandardscripts.ControlScripts
areexecutedfirst.(See"ControlScripts"onpage838.)
Note: RegisteringmultiplepartialswithasinglecallisnotsupportedinOLConnect.
Page 669