Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve the trigger object of the Automation in Jira Assets?

Dominik Hufnagel July 10, 2023

Hi together,

in Jira Asset Management I can create Automations

WHEN: Object created, Object updated

IF: objectType in (Processes)

THEN: execute groovy script

 

how in the groovy script can I retrieve the object of the WHEN-clause. Or in other words how do I retrieve the trigger object-key?

 

Would be nice, if somebody can support.

 

1 answer

0 votes
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 12, 2023

In your groovy script, before you even write the first line of code, there will be 2 or 3 variables.

log : an object of type org.apache.log4j.Logger to allow you to send messages to the insight_automation.log

object : an object of type 

com.riadalabs.jira.plugins.insight.services.model.ObjectBean that is the subject of the automation
objectUpdateList : a list of com.riadalabs.jira.plugins.insight.services.model.ObjectUpdateBean that can be used to find out which attributes were changed (only in Object Updated events)
So if you want to examine the object key, you can log it out like this:
log.info "Running script on $object.objectKey - $object.label"

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events