You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I am trying to get the select list value from JIRA and pass on the value to payload.
Example:
Custom Field = Impact
Type = Select List
If I give the value directly as Impact = "Medium" and pass the payload , I am getting a 200 status code
but if I try with the below method,
def impact = customFieldManager.getCustomFieldObjectByName("Impact")
def impactV = issue.getCustomFieldValue(impact).toString()
log.info("Impact is " + impactV)
am getting the below error,
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.fields.ImmutableCustomField.call() is applicable for argument types: (String) values: [Medium] Possible solutions: wait(), any(), wait(long), each(groovy.lang.Closure), tap(groovy.lang.Closure), any(groovy.lang.Closure)
Can someone please help me with this?
In your description, you mentioned:-
I am trying to get the select list value from JIRA and pass on the value to payload.
May I know what you are using the pass the value? Is it a Post-Function?
I've done a basic test in my environment using the Post-Function, and I do not seem to be encountering any problems.
From the code that you have shared, I notice a bad approach, i.e.:-
def impact = customFieldManager.getCustomFieldObjectByName("Impact")
This approach has been deprecated.
You should instead invoke your custom field like:-
def impact = customFieldManager.getCustomFieldObjectsByName('Impact').first()
Below is the sample code that I have tested with:-
import com.atlassian.jira.component.ComponentAccessor
def customFieldManager = ComponentAccessor.customFieldManager
def sampleList = customFieldManager.getCustomFieldObjectsByName('Sample List').first()
def sampleListValue = issue.getCustomFieldValue(sampleList) as String
log.warn "=====>>>> Value Selected: ${sampleListValue}"
Below is a screenshot of the test that I have done. I have selected Option 1 from the Sample List field.
Once the issue transitions, the log output returned is:-
2022-08-11 16:42:26,805+0800 http-nio-9091-exec-16 WARN admin 1002x668x1 1incwoo 0:0:0:0:0:0:0:1 /secure/WorkflowUIDispatcher.jspa [c.o.scriptrunner.runner.ScriptBindingsManager] =====>>>> Value Selected: Option 1
I hope this helps to answer your question. :)
Thank you and Kind regards,
Ram
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.