Team,
With the custom script I am able to add new components ( Component name, Lead, Description ) every time I create a new issue based on the summary, description, assignee.
However I want to be able to update the existing Component Information by creating a look back transition and applied the below script, it did not change the existing component and created a new component instead.
Any help would be appriciated
Hi @Ivan Tovbin
Thank you for your answer but i have a probleme
can you help me please - > https://community.atlassian.com/t5/Jira-Software-questions/Updated-Components-between-Projects/qaq-p/1949873
Thanks in advance
Hi @Ivan Tovbin
I succeedded do the function create and update a component between project but actually i find for do delete
You have idea ?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mani,
Here's how you update a component list for a given issue:
def componentns = issue.getComponents()
components.add(newComponent)
projectComponentManager.updateIssueProjectComponents(issue, components)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ivan Tovbin
I would like create a script listenner when i modify the name component he change in the other project
I have this script but he don't work because i have projectComponenetManager.create so when i edit a component he go to create a new component instead of to edit in the other projet linked
Look the script
You have idea for implants the "project projectComponentManager.update" in the place of "projectComponenetManager.create" because actually when i edit a component he to create a new component with the names changed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Salim Hammar If I understand your requirement correctly, you have a listener that monitors component name changes in one project and updates components with the same name in other projects to keep them all in sync.
If the above is true then you have a logic problem in your code. Specifially here:
def componentTemp = projectComponentManager.findByComponentName(project.getId(), component.getName())
Here, you are trying to find the components in other project with the same name. If none are found then create a new one, else uptade existing one. The problem is that right now you will NEVER find a component with the same name and thus will ALWAYS create a new one. This is because the listener triggers AFTER the name of the source component have been changed. And you are using a NEW component name to find a component in existing project. You need to somehow get the OLD name of the source component and use it instead to search for existing components in other project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ivan Tovbin
I succeedded do the function create and update a component between project but actually i find for do delete
You have idea ?
Thanks in advance
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To delete a component you need to call the delete(Long componentId) method from:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Ivan Tovbin
Thanks you for your answer , i would like knwo it's possible to blocked a add component in the project jira ?
Or a function when i create a component this he deleted automatically ?
Thanks in advance ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Salim Hammar I don't think there is a way to block component creation. If a user has Project Administrator permission, he can create components.
Sure, you can delete components right after they are created. For this you'll need a listener which would monitor the ProjectComponentCreatedEvent (https://docs.atlassian.com/software/jira/docs/api/7.6.1/com/atlassian/jira/event/bc/project/component/ProjectComponentCreatedEvent.html).
But honestly if you need to delete something that wasn't supposed to be created in the first place, the best practice would be to review your whole business process, so that it doesn't involve creating any potentially unwanted entities.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.