Can't get any of the advapist scriptrunner transition samples to work

Edwin Pabustan March 20, 2018

New at scriptrunner and was trying to see how it works.

Tried the following example in one of my workflow transition (validator):

  • issue.assignee != originalIssue.assignee

 

Get the following error:

  • It seems that you have tried to perform an illegal workflow operation.

    If you think this message is wrong, please contact your JIRA administrators.

 

Can someone please assist?

1 answer

1 accepted

0 votes
Answer accepted
Edwin Pabustan March 20, 2018

Tried to add a transition screen, which somewhat works, except the screen is shown regardless of whether the condition is true or false and sort of defeats the purpose.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2018

That's not what Conditions do.  A condition is a pre-check that returns true or false to Jira.  If true, the transition appears on screen and the user can perform it.  If false, the user is not offered the transition at all.

Where did you see your code (that does not work)?  I suspect the error is because originalissue is not a thing.

Edwin Pabustan March 20, 2018

Hi Nic,

Thanks for replying...

I'm trying to add a validator (simple scripted validator):

  • check whether the assignee is unassigned
  • if it is, ask the user to assign it
  • or if it is assigned, continue the transition

 

Here's the code behind it:

  • Condition: issue.assigned == ""
  • Error Message: Assignee is required
  • Field: Assignee

 

Seeing the following regardless of whether the assignee is Unassigned or assigned to a user:

  • It seems that you have tried to perform an illegal workflow operation.

    If you think this message is wrong, please contact your JIRA administrators

 

Tried the following:

  • Created a screen with just the assignee field
  • Assigned that screen to the transition

 

Results:

  • The screen is shown regardless of the value of the assignee field

 

All I really want to do is:

  • Popup a screen to allow the user to assign the issue when the assignee is unassigned
  • Continue with the transition when the assignee is set

 

Me thinks I may just be missing something here just for being a newbie on this and any help is appreciated.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 20, 2018

Ah, sorry, I looked in the wrong place too.  "Condition" and "Validator" have specific meanings in Jira and unfortunately, the SR team has used "Condition" in the config UI - it's right, but it confused me.

In Jira speak, validators, conditions, post-functions and triggers are chunks of code you add to a transition.  A validator is similar to a condition, but it checks data after the user has entered something in the transition screen (if there is one)

To get the behaviour you describe, you will actually need to create two transitions from and to the same place, because that's not how transition screens work.

On one transition, give it your "assignee" screen.  Add a condition of "check assignee is empty", and a validator to check it has been filled in by the user.

On the second transition, do not give it a screen.  Add a condition of "check assignee is not empty"

Edwin Pabustan March 20, 2018

Many thanks Nic - that worked perfectly!

:-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events