Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Wyt is wrong with Issue object which is not recognised ?

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

Where is this script running? 

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

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
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

226 views 7 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you