Uploaded image for project: 'Jira Service Management Cloud'
  1. Jira Service Management Cloud
  2. JSDCLOUD-10002

Assets Automation: The ability to trigger Automations based on Assets Object attributes.

    • 256
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      Ex: Change a Contract Object's Status to "Expired" once the "Expiration Date" is overdue.

      It would also be beneficial to trigger the rule based on object type in addition to the object schema 

      WorkAround : https://confluence.atlassian.com/jirakb/assets-automation-trigger-rule-based-on-attribute-update-1456179255.html 

            [JSDCLOUD-10002] Assets Automation: The ability to trigger Automations based on Assets Object attributes.

            Luka Haest added a comment -

            c02f7a849e2e 
            Indeed, you especially need to watch out for bulk edits with the workaround because it can trigger the rate limiting on automation.
            We experienced this when we updated the vendor in our environment from Hewlett-Packard to HP.

            Luka Haest added a comment - c02f7a849e2e   Indeed, you especially need to watch out for bulk edits with the workaround because it can trigger the rate limiting on automation. We experienced this when we updated the vendor in our environment from Hewlett-Packard to HP.

            As the description has been updated with a workaround I just want to point out again that the workaround isn't really suitable for anything at a larger scale. Unless I'm misunderstanding how it works.

            Using automation you can:

            • Detect changes to the asset object as a whole and then double checking if the attributes changed over the api.
              • This invokes automation executions every time whether your desired attribute has changed or not because you're still using the 'send web request' action.
              • For environments that sync regularly via Discovery this could trigger thousands upon thousands of individual rule executions.
            • Run a scheduled automation rule periodically
              • This would enabled you to branch through a filter of 'Assets updated within the last x hours'
              • This is limited to 1000 branches

            Dave Meredith added a comment - As the description has been updated with a workaround I just want to point out again that the workaround isn't really suitable for anything at a larger scale. Unless I'm misunderstanding how it works. Using automation you can: Detect changes to the asset object as a whole and then double checking if the attributes changed over the api. This invokes automation executions every time whether your desired attribute has changed or not because you're still using the 'send web request' action. For environments that sync regularly via Discovery this could trigger thousands upon thousands of individual rule executions. Run a scheduled automation rule periodically This would enabled you to branch through a filter of 'Assets updated within the last x hours' This is limited to 1000 branches

            For my use case, I want to trigger automated updates on asset objects and asset object relationships when the user's location value (automatically synced in from Azure AD) is updated.

            Megan Hartz added a comment - For my use case, I want to trigger automated updates on asset objects and asset object relationships when the user's location value (automatically synced in from Azure AD) is updated.

            Hi,

            Does anyone have an ETA on this request? 

            I need to be able to trigger email notifications as soon as an assets value changes in a certain attribute. 
            Example: 
            When a laptops status changes from "In Service" to "Damaged" my finance department needs to be informed of this as they need to action it promptly for insurance and reporting etc. 

             

            Looking forward hearing back. 

             

            Thanks in advance, 

            Juandré Mouton added a comment - Hi, Does anyone have an ETA on this request?  I need to be able to trigger email notifications as soon as an assets value changes in a certain attribute.  Example:  When a laptops status changes from "In Service" to "Damaged" my finance department needs to be informed of this as they need to action it promptly for insurance and reporting etc.    Looking forward hearing back.    Thanks in advance, 

            My use case is importing 'Laptops' and 'Last Logged On User' which is something that will sync on a daily basis.

            The problem with this workaround is that it requires a chargable automation rule action execution just query the api and just assess whether the attribute that you're watching has changed or not. If it hasn't, you've wasted one of your limited executions.

            For CMDBs with lots of changes this is going to mount up incredibly quickly.

            Hopefully this is something Airtrack / Datamanager will bring some extra functionality to solve?

            David Meredith added a comment - My use case is importing 'Laptops' and 'Last Logged On User' which is something that will sync on a daily basis. The problem with this workaround is that it requires a chargable automation rule action execution just query the api and just assess whether the attribute that you're watching has changed or not. If it hasn't, you've wasted one of your limited executions. For CMDBs with lots of changes this is going to mount up incredibly quickly. Hopefully this is something Airtrack / Datamanager will bring some extra functionality to solve?

            Malene Vikkelsø added a comment - - edited

            Another use case that enabling a specific attribute/objectType in the trigger is:

            You have multiple objectTypes, amongst others:

            • Offices
            • Employees
            • Computers

            On Employees, there is an attribute "Office" that refers to objectType Office.
            On Computers, there is also an attribute "Office" that refers to objectType Office. There is also an attribute "Employee" that refers to objectType Employees.

            Computers' attribute Office should be set based on the attribute Office of Employee referenced on the object. So an Employee is located at the London Office, then the Office of that Employee's Computer should also be set to London.

            Now an automation rule should automatically update the Computer's Office-attribute if the Office-attribute of the Employee is updated. So our Employee from before is moved to the Paris office, now the Computer's Office-attribute should automatically be updated to Paris as well.

             

            With the help of Atlassian support, I have managed to create an automation rule that supports the need, though the rule is more complex than it needed to be, if automation rule supported a more advanced object-updated trigger.

            Trigger: Object Updated

            AQL Condition: objectType = Employees

            Action: Lookup objects: objectType = Computers and Employee = object.key

            smart value condition: {{lookupObjects.Office}} does not equal {{object.Office}}

            Action: create variable, name: var - smart value: {{object.Office}}

            Branch on AQL: query: Key IN ({{lookupObjects.key)}}

            Branch Action Edit object: atribute "Office", value: {{var}}

             

             

            Malene Vikkelsø added a comment - - edited Another use case that enabling a specific attribute/objectType in the trigger is: You have multiple objectTypes, amongst others: Offices Employees Computers On Employees, there is an attribute "Office" that refers to objectType Office. On Computers, there is also an attribute "Office" that refers to objectType Office. There is also an attribute "Employee" that refers to objectType Employees. Computers' attribute Office should be set based on the attribute Office of Employee referenced on the object. So an Employee is located at the London Office, then the Office of that Employee's Computer should also be set to London. Now an automation rule should automatically update the Computer's Office-attribute if the Office-attribute of the Employee is updated. So our Employee from before is moved to the Paris office, now the Computer's Office-attribute should automatically be updated to Paris as well.   With the help of Atlassian support, I have managed to create an automation rule that supports the need, though the rule is more complex than it needed to be, if automation rule supported a more advanced object-updated trigger. Trigger: Object Updated AQL Condition: objectType = Employees Action: Lookup objects: objectType = Computers and Employee = object.key smart value condition: {{ lookupObjects.Office }} does not equal {{ object.Office }} Action: create variable, name: var - smart value: {{ object.Office }} Branch on AQL: query: Key IN ({{lookupObjects.key )}} Branch Action Edit object: atribute "Office", value: {{var }}    

            Hello, will this feature get introduced?

            Aleksandra Leesment added a comment - Hello, will this feature get introduced?

            This is good 74f0f3156212  
            Will include this in the document as an optional step for someone who is looking to get objectTypeAttributeId dynamically. 

            Swati Kahol added a comment - This is good 74f0f3156212   Will include this in the document as an optional step for someone who is looking to get  objectTypeAttributeId  dynamically. 

            Italo Lobato added a comment - - edited

            skahol,

            Any idea on how to get the objectTypeAttributeId dynamically instead of hardcoding it?

            I'm working with a 5 objects types which shares the same attribute , and Status is the attribute we need to automate.

            When we close the issue, we want to update the Status attribute in Insight.

            The challenge with your workaround is that Status attribute have different objectTypeAttributeId for each object type, and the workaround uses a hardcoded;

             


            Update: I was able to get dynamically the objectTypeAttributeId by including these steps in my Automation prior the update

            • Action: Send web request
              • Method: GET
              • URL:
                https://api.atlassian.com/jsm/insight/workspace/{{workspaceId}}/v1/objecttype/{{Insight Field.objecttype.id}}/attributes
                
            • Create variable ( Get all attributes in a format Name:1,Status:2,Attribute:ID.... ) 
              • Variable name: attributes
              • Smart value:
                {{#webhookResponse.body}}{{name}}:{{id}}{{^last}},{{/}}{{/}}
                
            • Create variable ( Extract from the attribute variable the id value from Status )
              • Variable name: statusAttributeId
              • Smart value: 
                {{attributes.match(".*Status:([0-9]+).*")}}
                

            This should be easier.

            Italo Lobato added a comment - - edited skahol , Any idea on how to get the objectTypeAttributeId  dynamically instead of hardcoding it? I'm working with a 5 objects types which shares the same attribute , and Status is the attribute we need to automate. When we close the issue, we want to update the Status attribute in Insight. The challenge with your workaround is that Status attribute have different objectTypeAttributeId for each object type, and the workaround uses a hardcoded;   Update: I was able to get dynamically the  objectTypeAttributeId  by including these steps in my Automation prior the update Action: Send web request Method: GET URL: https: //api.atlassian.com/jsm/insight/workspace/{{workspaceId}}/v1/objecttype/{{Insight Field.objecttype.id}}/attributes Create variable ( Get all attributes in a format Name:1,Status :2,Attribute:ID....  )  Variable name: attributes Smart value: {{#webhookResponse.body}}{{name}}:{{id}}{{^last}},{{/}}{{/}} Create variable ( Extract from the attribute variable the id value from Status ) Variable name: statusAttributeId Smart value:  {{attributes.match( ".*Status:([0-9]+).*" )}} From this point I did the same as documented in the workaround  Update Insight object status to expired using automation This should be easier.

            Hi Everyone,
            Worth checkig if the following article helps you achieve your use case scenario Update Insight object status to expired using automation

            Swati Kahol added a comment - Hi Everyone, Worth checkig if the following article helps you achieve your use case scenario Update Insight object status to expired using automation

              7260236ab89d Justin King
              afac94f0ceda Jake Sullivan
              Votes:
              204 Vote for this issue
              Watchers:
              114 Start watching this issue

                Created:
                Updated: