Is ScriptRunner's originalIssue valid in workflow transition's Post-function?

Before banging my head much further, I have a question:

Is ScriptRunner's originalIssue valid in workflow transition's Post-function?

Reading https://jamieechlin.atlassian.net/wiki/display/GRV/Built-In+Scripts#Built-InScripts-TechnicalStuffforAdvancedUsers, not sure if only available in validators.

I'm using scriptRunner to send an email in the post-function if the value of that custom text field changes. i.e. the Condition:

def cf = customFieldManager.getCustomFieldObjectByName('CSR#')
val = issue.getCustomFieldValue(cf)
oldVal = originalIssue.getCustomFieldValue(cf)
val == oldVal

The email is being email every time whether the CSR# field is changed or not. What have I done wrong this time.

C/Perl guy ;-)

2 answers

1 accepted

Accepted Answer
0 votes

Reworked the workflow and made setting the CSR# field in a separate global transition which only a certain jira group can fired. Problem solved for now until I run into the next problem that requires reindexing. ;-)

After more testing, I believe that once the transition's post-functions start to be evaluated, the originalIssue equals the issue object. So in a post-function, what is the best way to trigger a post-function email generation when a custom field is changed? Have a hidden text field saving the previous value?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

467 views 7 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you