2022.2

Table Of Contents
var rows = query("tr", table);
var cells = query("td", rows);
Sincetheresultsobjectalsoistheresultofaquery(forelementsthatmatchtheselectorofthe
script),itcanbepassedascontext.Forexampleinascriptwiththeselector“table”.
var rows = query("tr", results);
query(html)
CreatesanewHTMLelementontheflyfromtheprovidedstringofrawHTML,andreturnsthenewele-
ment.
html
AStringcontainingaHTMLelement.Tagsthatcancontainotherelementsshouldbepairedwithaclos-
ingtag.
Example
Thefollowingscriptaddsaparagraphtotheresults(elementsthatmatchtheselectorofthescript).
var div = query( '<div>' );
for ( let i = 0; i < 5; i++ ){
var p = query( '<p>' );
p.text( 'This is number ' + i );
div.append( p );
}
results.after( div );
Tip: TheDynamicAttachmentscriptusesthisfunctiontoaddanattachmenttoanEmailsection;
see"Emailattachments"onpage489.
record
Therecordobjectgivesaccesstotherecordthatiscurrentlybeingmergedwiththetemplate.
Properties
Field Type Description
<fieldName>
Object Shortcuttoaccessafieldinthefieldsarray.Forexample,youcanuse
record.FirstNametoaccessrecord.fields.FirstName.
Ifarecordhasafieldandatableofthesame name,record.<fieldName>will
returnthetable.
Page 1199