I think you need to use something like set foo = 3
this was a bit while ago , I don't remember exactly how I came up with this snippet but its working , hope it helps.
{% set numOfAlarms = template_helper.get_incident_value(incident,'number_of_alarms') | int %}
{% if numOfAlarms > 1 %}
{{ template_helper.get_datatable('log_r_events',template_helper.get_incident_value(incident,'id'))|safe}}
{% endif %}
------------------------------
mohamad islam hamadieh
------------------------------
Original Message:
Sent: Mon March 27, 2023 11:28 AM
From: Diego Mastrolorenzo
Subject: Jinja context in outbound email
Hi there!
I'm using the app Outbound email 2. My question is:
In normal python you can pass a context to a jinja2 template. can something similar be done here?
Say, for example I want my template to reference a variable that was previously set on my script. Take this example:
inputs.mail_to = "mail@mail.com"inputs.mail_incident_id = incident.idinputs.mail_subject = "TEST JINJA"inputs.mail_message_id = f"someid@resilient.ypf.com"foo = 3inputs.mail_inline_template ='''{{ foo }}'''
I need to reference 'foo' inside the template. But this snippet of code gives error 'unknown foo in template line 2'.
Any idea how can this be done?
------------------------------
Diego Mastrolorenzo
------------------------------