0

Is scripted field appear on ISSUE EDIT or any transition screen?

For me, it appear on issue view screen only and unable to see on issue edit screen.

I want it to appear on EDIT screen as well as a readonly.

(have verified by just keeping - "free text template" and - return "some value").

Another:

When I have use below script on scripted field then it shows me error while execute:

Error message as below:
The indexer for this field expects a java.lang.String but the script returned a com.atlassian.jira.issue.fields.CustomFieldImpl - this will cause problems.

Code:

  import com.atlassian.jira.ComponentManager.  
  import com.atlassian.jira.issue.fields.CustomField 
  import com.atlassian.jira.issue.CustomFieldManager 
  CustomFieldManager customFieldManager = componentManager.getCustomFieldManager() 
  def componentManager = ComponentManager.getInstance() 
  def issueLinkManager = componentManager.getIssueLinkManager()  
  def selectedValues = customFieldManager.getCustomFieldObject("customfield_11447")
  //custom field has multi selected values as it is a "multi select" field type. 
  return selectedValues

How I could use scripted field in issue edit/transition screen and also resolve above error.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
dsi
  • 3,199
  • 12
  • 59
  • 102

1 Answers1

1

For the first part of your question, no a scripted field wont be displayed on a Create, Edit or Transition screen. There is a work around for transition screens but I have not tried it https://gist.github.com/jechlin/5380119

Now the second part of your question. You are returning an object of CustomeField and you should be returning a String. What you want to do is

change this

def selectedValues = customFieldManager.getCustomFieldObject("customfield_11447") 

to this

def cf = customFieldManager.getCustomFieldObject("customfield_11447")
def selectedValues = cf.getValue(issue)

Here is a link to the api documentation for JIRA (6.0.4): https://developer.atlassian.com/static/javadoc/jira/6.0.4/reference/packages.html

DeonHeyns
  • 123
  • 4
  • I cant add more links but here is a link to the Scripted Fields documentation: [link](https://jamieechlin.atlassian.net/wiki/display/GRV/Scripted+Fields) – DeonHeyns Jul 17 '13 at 18:23
  • Many thanks. can you please suggest any other approach through jquery/javascript which allows me to create such duplicate field and it could also appear on EDIT screen ? basically, requirement is just have a review screen and EDIT issue screen (review tab) where match the EXPECTED and ACTUAL field) so, EXPECTED field is the duplicate of existing field. – dsi Jul 18 '13 at 06:33