i am creating an Azure logic app workflow. as a part of it, i have an array and i need to create a table, for each item in the array i need to have one row in the table. and finally send that table via email. i have tried the inline java script action with the below code. but i get error InlineCodeScriptRuntimeFailure. The inline code action 'JavaScriptCode' execution failed, with error 'document is not defined'.
anyone knows how i can fix it? or is there any other way to do that?
var rows = [{
name: "John",
age: 20,
email: "[email protected]"
}, {
name: "Jack",
age: 50,
email: "[email protected]"
}, {
name: "Son",
age: 45,
email: "[email protected]"
}];
var html = "<table border='1|1'>";
for (var i = 0; i < rows.length; i++) {
html+="<tr>";
html+="<td>"+rows[i].name+"</td>";
html+="<td>"+rows[i].age+"</td>";
html+="<td>"+rows[i].email+"</td>";
html+="</tr>";
}
html+="</table>";
document.getElementById("box").innerHTML = html;
2
Answers
Code is true. Do you work with any frameworks?
To achieve this follow below design:
Inline code modified at end a bit:
Compose Action:
Output: