I am working on creating a workflow to send out an email. In the email I need to set up a dynamic table based on an http response from an API call. Some users have more then one entitlement applied to them. I need to be able to create a table that shows the list of entitlements.
Here is what I have so far. Is there any reason I would not be able to use JavaScript to accomplish this task?
<!DOCTYPE html>
<html>
<style>
table, th, td {
border:1px solid black;
}
</style>
<body>
<p>
A standard Epic account has been created for your newly hired caregiver. The account includes the ability to log in and function in their current position. You will need to submit a Service Management Suite (SMS) request for any additional access that is needed. Examples of additional access include, but are not limited to, pools, work queues, deposit tools and cash drawer.
</p>
<p>Epic UserID: ${userID}</p>
<table id="entitlements">
<tr><td>${entitlement1}</td></tr>
<script type="text/javascript">
let table = document.querySelector('#entitlements');
let entitlement2 = ${entitlement2}
let data = document.createElement('td');
if(entitlement2 !== null){
data.textContent = entitlement2;
table.append(data);
}
<script>
let entitlement3 = ${entitlement3}
if(entitlement3 !== null){<tr><td>output.innerHTML = ${entitlement3}</td></tr>}
</script>
<script>
let entitlement4 = ${entitlement4}
if(entitlement4 !== null){<tr><td>output.innerHTML = ${entitlement4}</td></tr>}</script>
</table>
<p>
NOTE: The Epic Security team is improving the provisioning process. This includes the automatic creation of Epic accounts for newly hired caregivers in specific positions. However, because other systems have not been automated, you still need to request any other system access through an SMS request.
</p>
</body>
</html>
{"entitlement1.$":"$.hTTPRequest2.body[0].name", "entitlement2.$":"$.hTTPRequest2.body[1].name", "entitlement3.$":"$.hTTPRequest2.body[2].name", "entitlement4.$":"$.hTTPRequest2.body[3].name", "entitlement5.$":"$.hTTPRequest2.body[4].name", "userID.$":"$.hTTPRequest1.body[0].attributes.UserID"}