I have created the n8n work flow to get an email and http-trigger for the Jira ticket.
Currently, below is the list of items which I am getting from the http-request in generally.
I have selected the HTML and When I see the email in the outlook I am not able to see the table data
JSON to Table
// Get the hostname data from the template variable
var jsonData = {{$json.itemlist}};
// Check if jsonData is an array
if (Array.isArray(jsonData)) {
// Loop through the JSON data and generate table rows
for (var i = 0; i < jsonData.length; i++) {
document.write('<tr>');
document.write('<td>' + jsonData[i] + '</td>');
document.write('</tr>');
}
} else {
// If jsonData is not an array, display a single row
document.write('<tr>');
document.write('<td>' + jsonData + '</td>');
document.write('</tr>');
}
</script>
</table>
But I am not getting the table foramt . Please help us .
Hi @DilipChiru, how about using the HTML node to build your table? You wouldn’t even need to create an array using the Item lists node first, as it can accept multiple incoming items at once. For example:
I need one help and suggestions. When we have list of item for example as below.
king,
qeen,
makhir
Basically, I am trying to check the elasticsearch list of items every 24hrs. Out of 100 item is there anything missing. Currently, I am missing those " king,qeen, makhirIt " and will create a JIRA ticket saying these items are missing in last 24hrs. When we have additional item missing in next 24hrs so It will create one more ticket with all list of missing. So If we keep missing then it will create multiple tickets for one single issue.
Is there any way, So I can append the latest item for example “rocket” is the value , it should update/append the value to existing ticket and for example. if the “king” is available again in it should strike the value in the description or table.
So you essentially have one list with values such as king, qeen, makhirand another list that might be missing one (or more) of these values so you can further process the missing values? In this case you probably want to use a Merge node in Combine/Keep Non-Matches mode like so:
In this example, the first input branch would provide a list of items with values king, qeen, makhir. The second (lower) input branch only provides king and makhir. The Merge node would identify the missing item and you can further process it as needd:
With regards to Jira you will unfortunately not be able to re-use your HTML table. Afaik Jira does not accept HTML when creating a ticket. Instead you’d need to build your Jira table using a but of custom code, for example like so:
This example would create a Jira table based on the incoming data looking like so:
Please help me using http_request . Currently, I am using onprem.
I have some 10 values which are missing to send in to http_request Jira creation. But when I see in the jira ticket it is printing like raw table which I took from the HTML instead of table in the deception
Hi @DilipChiru, you can also use the examples from my workflows above in an HTTP Request node. Simply reference the data using an expression such as {{ $json.table }}:
Hi @DilipChiru, this looks pretty much like what it says in the error message. The way you are using the expression would result in invalid JSON (because JSON doesn’t allow line breaks).
Looking at your screenshot, perhaps you want to try {{ JSON.stringify($json.table) }} instead?
I’m sorry @DilipChiru. Perhaps you want to wrap your entire JSON body in {{ and }}? Like so:
This will make it considerably easier to see whether you are producing a valid JSON object or not as n8n will shows this in the preview using [Object: at the start:
Hi @DilipChiru, you can simply copy the HTTP Request from my example workflow above. Simply select it and press Ctrl+C. Then switch to your own canvas and use Ctrl+V.
I am sorry to ask again,
But it doesn’t contain the object related to JSON Structure. Please share me the details related to it which is GREEN in color