2022.2

Table Of Contents
Inline partials
Inlinepartialsaresupportedaswell.Seethetwoexamplesathttps://-
docs.w3cub.com/handlebars/partials#inline-partials.
Unsupportedfeatures
ThefollowingHandlebarspartialsfeaturesarenotsupportedinOLConnect.
l
Passingacustomcontextasaparameter.
l
Passinghashparameters(seehttps://devdocs.io/handlebars/partials#partial-parameters).
Handlebars API
ThistopicliststhefunctionsofHandlebarsthataresupportedinDesignerscripts.Italsolistsfeatures
thatareunsupportedinOLConnect.
Note: TheinformationinthisOnlineHelpfocusesontheimplementationofHandlebarsinOL
Connect.ForgeneralinformationaboutHandlebarsandhowtouseit,seethefollowingweb
sites:https://handlebarsjs.com/andhttps://devdocs.io/handlebars.
Functions
compile('template') CompilesthespecifiedHandlebarstemplate*intoafunctionthatcanbecalledwithdata**.Forexample:
const template = Handlebars.compile('snippets/Template1.hbs');
const result = template(record);
Note: PassingoptionsisnotsupportedinOLConnect.
render('template',data) RendersaspecifiedHandlebarstemplate*bycompilingthespecifiedHandlebarstemplateintoafunctionandimme-
diatelycallingthatfunctionwithdata**.
Handlebars.render( "snippets/Template.hbs" )
isidenticalto:
const compiledTemplate = Handlebars.compile( "snippets/Template.hbs" )
compiledTemplate( record )
Ifdataispassed,thatdataisusedtorenderthetemplate.
Ifnodataispassed,thecurrentrecordisusedtorenderthetemplate.
TheresultofthisfunctionisHTML.
Seealso:"Handlebarstemplates"onpage774.
registerPartial('name',
'template')
RegistersaHandlebarstemplate*asapartialwiththespecifiedname.
Forexample,thislineofcoderegistersatemplate(clauses.hbs)asapartialwiththename'clauses':
Handlebars.registerPartial('clauses', 'snippets/partials/clauses.hbs');
ThepartialcanthenbereferredtobyitsnameinHandlebarstemplatesaswellasfunctionsusing{{> partialName}}.For
example:{{> clauses}}.
See:"Partials"onpage777.
Page 780