Forums

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

Checking for ScriptRunner Issue Created event in listener

AbrahamA
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.
January 21, 2022

Hello All

I have to do a task only if 'PNR Name' Changed.

I am trying to skip the check on Issue Created, but I am not finding a way to check on the event. First line in code below is giving error (I understand method is not available)

Can you please tell me how to do this check for Issue Created Event

 

 

 

/if(event.getName() != 'Issue Created'){
// If product name did not change return
def changeLog = event?.changeLog
def changeItems = changeLog.getRelated("ChildChangeItem")
def change = changeItems?.find{ it.field == "PNR Name"}
if(!change){
return
}
//}

 

Thanks

Abe

2 answers

1 vote
AbrahamA
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.
January 21, 2022

 

I tried this as well

if(event instanceof IssueCreatedEvent)

How do I check in scriptrunner listener for IssueCreated Vs IssueUpdate etc?

0 votes
Hector Vazquez
Contributor
November 9, 2022

The code above didn't work for me also, but I used the "eventTypeId" property instead:

if ( event.eventTypeId == 1 )

You can trigger the event and debug it:

log.debug("Event Id = " + event.eventTypeId )

Suggest an answer

Log in or Sign up to answer