Skip to main content
Skip table of contents

How to use Snipe-IT for Jira With Jira Automations

Triggering a Jira Automation on Changes to Linked Assets

You can use Jira Automation to trigger on changes made to the Snipe-IT Assets IDs field or any other custom label field you have configured to be used by Snipe-IT for Jira, with the Field value changed trigger.

Be aware that if you are using an Automation with the Issue created trigger in a Jira Service Management project where users are selecting the assets via the request form. And need the Snipe-IT for Jira custom field data later in the rule. You need to add a Delay action for 10 seconds and after that fetch the issue data with a Re-fetch issue data action. This is needed as Snipe-IT for Jira is only filling the custom label field after the issue has been created and not as part of the creation.

Using Snipe-IT Asset Data in Jira Automations

You can use data of your Snipe-IT assets in Jira Automations by using the Send web request action.

First, you need to use an Advanced branching branch. In this branch, you will iterate over all the labels (assets) in the custom label field Snipe-It for Jira is using to store linked assets. For that, you can use the {{issue.customfield_XXXXX}} smart value, where XXXXX needs to be replaced by the field ID of your specific custom field.

2024-11-27 13-25.png

The assets are stored as labels in the SITE_ASSETSTYPE_ASSETID format. We can extract these values to make requests to the Snipe-IT API and retrieve asset data. For that, we use two Create variable actions. One, will be set to the smart value {{asset.substringBetween("_", "_")}}. This will give the asset category/type needed for the API call. Next, we will set a variable to the smart value {{asset.substringAfterLast("_")}}. This variable will provide the asset ID for our API call.

2024-11-27 13-26.png
2024-11-27 13-26 (2).png

Now we can construct our Send web request action. The web request URL is constructed with our two variables we have defined above. E.g., https://YOURSNIPEITINSTANCE/api/v1/{{assetCategory}}/{{assetId}}

The HTTP method needs to be GET and the Web request body should be Empty.

The headers need to be configured as described here using a Snipe-IT API key.

Header

Value

Authorization

Bearer MY-AWESOME-API-KEY

Accept

application/json

Content-Type

application/json

Also, don’t forget to check the Delay execution […] option.

2024-11-27 13-26 (3).png

After this, you can use the {{webResponse.body}} smart value to retrieve all kind of values from your Snipe-IT asset to use in the automation. This way you can run automations conditional on some asset values or use these values to save them to a custom field.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.