Hi everyone,
I'm working on setting up a webhook alert to create tickets on our customer service portal. When a device encounters a problem, it will send a webhook to Jira, which will then automatically generate a ticket. I can define some information in the webhook payload template (in JSON format), and I would like to incorporate a function that selects the alerting device from a custom field.
Since I have an object schema with assets, I've configured a custom field for it. Initially, I attempted to include the serial number of the alerting device like this:
<span>"customfield_XXXXX"</span><span>:</span> <span>[</span> <span>{</span> <span>"name"</span><span>:</span> <span>"{{deviceSerial}}"</span> <span>}</span> <span>]</span>However, Jira ignored this field, leaving the custom field empty. On the other hand, when I used:
<span>"customfield_XXXXX"</span><span>:</span> <span>[</span> <span>{</span> <span>"objectId"</span><span>:</span> <span>"XXX"</span> <span>}</span> <span>]</span> successfully created a ticket with the alerting device selected in the custom field, as I directly specified the asset ID.
I'm looking for guidance on how to adjust the code so that I can update the custom field with the serial number or device name. Since we won't know in advance which device will trigger the alert, I can't simply use a fixed objectId. While I understand that automation is a great option, I would prefer to stick with API calls.
Thanks in advance!