Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterating through a list object - Handlebars #89

Open
Fuji183 opened this issue May 7, 2021 · 0 comments
Open

Iterating through a list object - Handlebars #89

Fuji183 opened this issue May 7, 2021 · 0 comments

Comments

@Fuji183
Copy link

Fuji183 commented May 7, 2021

Actual Behaviour

After communicating with the SendGrid engineers we have settled on a format / structure for our JSON payload and so far we have been able to reference values / properties using Handlebars syntax for our Dynamic templates. However, we now have to include properties that can be a list of values and the Handlebar syntax being used is unable to evaluate at run time

Expected Behaviour

The Dynamic template should be able to display the values within the list array

Steps to reproduce it

JSON file is structured as so:

{
"personalizations":[
{
"subject":"Waive Fee",
"dynamic_template_data":{
"template_data":[
{
"insurance":[
{
"PolicyType":"Comprehensive",
"InsuranceProvider":"Blue Elephant",
"InsuranceFinanced":false,
"InsurancePremium":0.0,
"PolicyId":""
}
],
"pyNote":"",
"pyApproveStatus":"Decline",
"CaseID":"S-7160",
"waiveFeeList":[
{
"Comments":"This is a test",
"DueDateValue":"29/06/2017",
"InvoiceNumber":"0014593711",
"InvoiceAmount":3.25,
"Reason":"Goodwill"
}
],
"userDetails":{
"pyUserName":"mrinalini",
"pyFirstName":"James",
"pyUserIdentifier":"mdubey",
"pyPosition":"",
"pyEmailAddress":"",
"pyTelephone":""
},
"customer":{
"Brand":"GENERIC",
"PartyRole":"",
"CifNbr":"CUST-77472",
"FirstName":"Paul",
"FullName":"Paul Tabbiner",
"ShortName":"Paul Tabbiner",
"LastName":"Tabbiner",
"OnyxID":"75422643",
"CustomerType":"Individual"
}
}
]
},
"to":[
{
"email":"rcsquest@gmail.com",
"name":"Paul Tabbiner"
}
],
"custom_args":{
"sourceSystem":"PEGA CRM",
"correlationId":"3b3e1db9-65f7-42de-bc80-186a4566e40c"
}
}
],
"reply_to":{
"email":"rcsquest@gmail.com",
"name":"Test Account"
},
"from":{
"email":"rcsquest@gmail.com",
"name":"Test Account"
},
"template_id":"d-eecec6cea3f049178816d411b9bde1b3"

}

An example of the Handlebars syntax being used to dynamically populate a Dynamic template with the 'Comments' value (that doesn't work):

								<ol>
							{{#each template_data.waiveFeeList}}
							<p><li>{{Comments}}</li>
							
							{{/each}}
							</ol>   

Please let us know if you can work on it or the issue should be assigned to someone else.

I can work on this issue
ListTest_sendgrid.txt
WaiveFee_template.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant