Hi
I would like know it's possible to blocked a add component in the project jira ?
Or a function when i create a component in the multiple projet this he deleted automatically ?
Thanks in advance
No, you can't block the addition of components by a project admin.
If you genuinely need to do that, then I'd suggest removing components from the project (hide them in the field configuration) and use a multi-select custom field instead.
You could write a listener to delete new components if you're ok with writing an app or have one of the scripting apps like Scriptruner or Power-scripts, but it would be a very very bad thing to do, as you'll be destroying valid data your people are trying to use.
Could you explain what problem you are trying to solve here? There's going to be a far better answer than kludging useful Jira functionality.
Okay @Nic Brough -Adaptavist- Thank you for your answer but i have a problem
in This script he create , update and delete the componnet in any project :
But I have 2 problems :
- When i chnage the lead for the component i goes on a loop
and
- When i change the lead for the component after when i go to acces for the pages components , the page no working
You have idea ?
---------------------------------------------------------------------------------------------
def dest_prj = ['TS', 'TD', 'TK']import com.atlassian.jira.bc.project.component.MutableProjectComponentimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.event.bc.project.component.ProjectComponentCreatedEventimport com.atlassian.jira.event.bc.project.component.ProjectComponentDeletedEventimport com.atlassian.jira.event.bc.project.component.ProjectComponentUpdatedEventimport com.atlassian.jira.project.AssigneeTypesimport com.atlassian.jira.project.Projectimport com.atlassian.jira.bc.project.component.ProjectComponent
def projectManager = ComponentAccessor.projectManagerdef projectComponentManager = ComponentAccessor.projectComponentManager
ProjectComponent component = event.projectComponentlog.info "Deletected ${event.getClass()} for $component.name ($component.id)"dest_prj.each { String destProjectKey ->log.info "Getting project object from dest_prj: $destProjectKey"def project = projectManager.getProjectObjByKey(destProjectKey)log.info "Project object found: $project"def destComponent = projectComponentManager.findByComponentName(project.id, component.name)log.info "Attempted to identify matching destination component in $project using name=$component.name : $destComponent"if (event instanceof ProjectComponentCreatedEvent) {if (!destComponent) {log.info "Attempting to create $component.name into $project"projectComponentManager.create(component.name, component.description, component.lead, component.assigneeType, project.id)} else {log.error "Can't create a copy of $component.name in $destProjectKey project. A component with that name alreay exist."}}if (event instanceof ProjectComponentUpdatedEvent) {def oldComponent = (event as ProjectComponentUpdatedEvent).oldProjectComponent as ProjectComponentif (event instanceof ProjectComponentUpdatedEvent) {destComponent = projectComponentManager.findByComponentName(project.id, oldComponent.name as String)log.info "Attempted to identify matching destination component in $project using name=$oldComponent.name : $destComponent"}if (destComponent) {log.info "Attempting to update $destComponent.name ($destComponent.id) from $project project using data from $component.name ($component.id)"destComponent = MutableProjectComponent.copy(destComponent)destComponent.with {name = component.namedescription = component.descriptionlead = component.leadassigneeType = component.assigneeType //or use component.assigneeType}projectComponentManager.update(destComponent)} else {log.warn "No component found in $destProjectKey with name $oldComponent.name. Can't perform an update."}}if (event instanceof ProjectComponentDeletedEvent) {log.info "Detected Component Deletion event for $component.name"if (destComponent) {log.info "Attempting to detelete $destComponent.name ($destComponent.id) from $project project"projectComponentManager.delete(destComponent.id)} else {log.warn "No component found in $destProjectKey with name $component.name. Can't delete it."}}}
----------------------------------------------------------------------------------------------
It looks like you're new here. Sign in or register to get started.