Summary
My goal is to convert a dynamic number of epoch values to a different format and use the result in the body of a web request.
It would seem that this is possible at first given that I can do this without issue outside of a loop. But within a loop, I receive this message: "The provided smart value was unable to be resolved to an object."
Any suggestions?
What works outside a loop
Log action:
{{epochDate.toDate("dd/MM/yyyy")
.plusSeconds(ts).convertToTimeZone("America/Chicago")
.format("MMM dd, yyyy hh:mm a z")}}*line breaks for readability*
Here epochDate is a custom variable that equals 01/01/1970 and ts is a custom variable for testing purposes. The result of this action is Sep 01, 2022 09:28 AM CDT.
Loop that breaks
Log action:
{{#webResponse.body}}
{{epochDate.toDate("dd/MM/yyyy")
.plusSeconds(ts).convertToTimeZone("America/Chicago")
.format("MMM dd, yyyy hh:mm a z")}}
{{/}}*line breaks for readability*
Here epochDate is the same value as above and ts is the epoch time received from a web request.
Web request action:
{
"ticket": {
"comment": {
"html_body":
"<table>
<tr>
<th>Time Sent</th>
<th>Status</th>
<th>Subject</th>
<th>Email</th>
<th>Sender</th>
</tr>{{#webResponse.body}}<tr>
<td>{{epochDate.toDate(\"dd/MM/yyyy\").plusSeconds(ts).convertToTimeZone("America/Chicago").format("MMM dd, yyyy hh:mm a z")}}</td>
<td>{{elasticsearch_index}}</td>
<td>{{subject}}</td>
<td>{{email}}</td>
<td>{{sender}}</td>
</tr>
{{/}}
</table>",
"public": false
},
"status": "new"
}
} *line breaks for readability*
Here epochDate is the same value as above and ts is the epoch time received from a web request.
All the other smart values that are iterated over are sent correctly, just the time that is causing problems. My guess is that the custom variable epochDate is somehow out of scope within a loop.
What I've tried
- Casting ts asNumber to ensure it wasn't converted to a string somehow
- Referencing ts by webResponse.body.ts
- Adding mustaches around both epochDate and ts with and without enclosing mustaches
- Making a list of just converted times but then I have to iterate again