Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,674
Community Members
 
Community Events
184
Community Groups

Wyt is wrong with Issue object which is not recognised ?

serge calderara
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.
Jun 19, 2020

Dear all,

I have the following script which is store in a file named SlackUser.groovy

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comments.CommentManager

import groovy.json.*
import groovyx.net.*
import groovyx.net.http.*
import static groovy.json.JsonOutput.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*

class SlackUser{

Issue refIssue

//Field defienition constant to be read from issue
String emailFieldName="Email Address" //10523
String emailField=""
public String emailFieldValue=""
CommentManager commentMgr=ComponentAccessor.getCommentManager()


SlackUser(Issue issue)
 { 

refIssue=issue
def customFieldMgr=ComponentAccessor.getCustomFieldManager()

emailField =customFieldMgr.getCustomFieldObjects().findByName(emailFieldName)
emailFieldValue=refIssue.getCustomFieldValue(emailField) <<< error


 }
}

Then I am calling that script from my Script console as below :

Issue refIssue=ComponentAccessor.getIssueManager().getIssueObject("TSD-2102")

SlackUser slk=new SlackUser(refIssue)

When the SlackUser object is created, I get a wierd error in the BOLD line above saying :

"groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueImpl.getCustomFieldValue() is applicable for argument types: (java.lang.String) values: [Email Address] Possible solutions: getCustomFieldValue(com.atlassian.jira.issue.fields.CustomField), setCustomFieldValue(com.atlassian.jira.issue.fields.CustomField, java.lang.Object) at ServiceRequest.SlackUser.<init>(SlackUser.groovy:53) at Script564.run(Script564.groovy:71)"

 

What is wrong and how to solve that error ?

regards

1 answer

1 accepted

0 votes
Answer accepted
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.
Jun 19, 2020

Where is this script running? 

serge calderara
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.
Jun 19, 2020

As I explain in my description thexscript which is building the reference object is called fron the script console

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.
Jun 19, 2020

Sorry, I missed that in the wall of text.

The problem is that you are forcing the emailField to be a string, when it isn't one.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events