I have a post function on create to copy the value from "Hiring Manager" (a single user picker custom field), to the "Request Participants" field for JIRA service desk.
This post function works beautifully, as long as the hiring manager is not also the reporter of the issue, as reporters are automatically added as "Request Participants".
Since hiring managers tend to be reporters quite often, I wanted to make this a conditional execution, where this post-function on runs when a condition returns true. I have a similar condition on another workflow post-function working, however I cannot seem to get this one to work.
Without any kind of condition validator to tell me if the expression is returning true or false, I'm not sure what to do next.
I currently have the condition written as:
issue.get("customfield_15480")!=issue.get("reporter")
Can someone help point me to where my mistake is in my syntax?
Solved it! Below is the proper syntax in case any one else has any of these issues:
!issue.get("customfield_15480").getName().equals(issue.get("reporter").getName())
Ok, found some more info and updated my condition to
issue.get("customfield_15480").getName()!=issue.get("reporter") log.error("Conditional Execution" + issue.get("customfield_15480").getName() + issue.get("reporter"))
The log file now shows
ERROR jtillett 1028x3177582x4 iyq99u /secure/QuickCreateIssue.jspa [jmwe.plugins.functions.CopyValueFromOtherFieldPostFunction] Conditional Executionjtillettjtillett:3 2016-05-12 17:08:20,632 http-bio-8080-exec-14009 ERROR jtillett 1028x3177582x4 iyq99u /secure/QuickCreateIssue.jspa [jmwe.plugins.functions.CopyValueFromOtherFieldPostFunction] Unable to copy value from 'Hiring Manager' to 'Request participants' java.lang.NullPointerException
So if the log file says the output of either side of the != are both equal to jtillett only, and the post function is only supposed to fire if the condition is TRUE, and jtillett!=jtillett is a false statement, then why is it still trying to run with a false condition?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have been able to determine that part of my issue is due to the data not truly matching.
issue.get("reporter") returns
username
issue.get("customfield_15480") returns
username(username)
The custom field is a single user picker field, just like reporter. How can I get the outputs to match?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I would just advise you to put the correct plugin's tag on the question, because the developers don't trawl through every single question on the offchance it's about their plugin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is there a way to bump this for help?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My mistake, I thought all the groovy stuff came from the script runner plugin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is not Script Runner, so I'll remove that plugin tag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.