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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

How to create a custom field like Components field? Edited

Hey, guys!

What I want is to create custom button which is the same like Component/s button:

Components field.png
So I need to have the content of Component/s button and behaviour of Component/s button in custom button.


I've tried to create a custom button and put this code inside of "Description":


(function($){
new AJS.MultiSelect({
element: $("#customfield_10653"),
itemAttrDisplayed: "label",
errorMessage: AJS.params.multiselectComponentsError
});
})(AJS.$);

 

However, the above code is not working and I see just the above code.

Guys, how can it possible to create custom field like "Component/s" button?

 

I have an option to use ScriptRunner.

3 answers

0 votes

@zaharovvv_suek_ru

Please KB article on  how to add new custom field Add custom field

What  do  you  hope to  achieve?  component field is a system  field  by  default.

 

Best

Thanks for your reply, Moses. I can add custom field, however I cannot create a custom field which is populated by components.

 

What I want is to create custom field "ComponentsLinked" which looks exactly the same like "Component/s" field and set Components value  in that custom field. 

How can I do it?

0 votes
Moses Thomas Community Leader Jun 13, 2018

@zaharovvv_suek_ruYou don't need to  create a  new one,  we have the component/s

field,  

  • Just go to knowledge base here see how to  Configure component
  • this values  for the component  will  appear on the screen as you already have this  field  added to screen .

 

Why you  want to  complicate things ?

 

Best!

@Moses Thomas yeah, I know, however I was asked by my chief to create the same custom field "ComponentsLinked" which looks exactly the same like "Component/s" field and set Components value  in that custom field. 

So I cannot protest to his requirements.

Is it possible to create such a field?

Moses Thomas Community Leader Jun 13, 2018

@zaharovvv_suek_ruI think its not designed for you to  add a system field.

Hello @zaharovvv_suek_ru

As I can remember, you are using scriptrunner

Component/s field it's just like labels field, so why not try to create labels field that will be populated from components via listener on Issue Update event?

@Mark Markov yeah, you are right! 

Thanks for your reply.

It sounds really good. However, I am not really aware how it is possible to populate by components and what does "via listener on Issue Update" event. Could you be very kind to clarify that?

Jira based on event architecture. When something happens(changes) in system, jira thtows an specific event(for example, when you made some changes to the field values, jira throws ISSUE_UPDATED event), that can be caught and processed by listeners. To make listener with Scriprunner go to add-ons -> Script listeners -> Add -> Custom script listener

Project key: What project lister will be affect

Event: On what event it will be triggered (in your case Issue Updated)

Inline/file script: And your script that will do all kind of magic you need.

Here is example of script that will catch changes of Component/s field:

def change = event?.getChangeLog()?.getRelated("ChildChangeItem")?.find {it.field == "Component"}

if (change) {
    log.debug "Value changed from ${change.oldstring} to ${change.newstring}"
 // your actions if the field has changed
}

@ Huge thanks! You make it clearer! Now it is really clear about events. 

However, is it possible:

1. To get components and populate custom field by this components? I mean like Components field.

2. To have behaviour like Components field - when I input letter in custom field, then autosuggestion of components will work?

Like kamrulhussain likes this

 Hello @zaharovvv_suek_ru ,

Did this work in your case , coz I am also having similar requirement, if not, then what was the thing that worked.

Thanks in Advance,

Nasreen

Suggest an answer

Log in or Sign up to answer
TAGS

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