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

Behaviours Plugin Question - Behaviour when cloning

clem Feb 25, 2016

Hi,

I have a behaviour that I would like not to be enacted during the clone of an issue.

Is there a way to prevent it?

Thank-you,

Cynthia

1 answer

0 votes
Kristian Walker Community Leader Feb 29, 2016

Hi Cynthia,

Behaviours are designed to perform some action when an issue is updated via the view or edit screen.

You cannot specify that a behaviour does not happen on an issue action. The only way to do this would be to clone to a different issue type which did not have the behaviours mapped to it.

I hope this helps.

Thanks

Kristian

Manjunatha K R Jan 31, 2017

Hi Kristian,

I am also having similar issue, where when I create multiple clone issues using my groovy script, all Cloned issues are created successfully but Behaviours's Validation Script(i,e Add-on->Behaviours->Subsystem) written to map subsystem - "module owner" custom field value is not getting updated successfully in new issues. 

is this not possible to enact using Behaviours Plugin Validation Script - when cloning issues using my below groovy script::

I believe cloneIssue() and createIssueObject() function will work with ) condition added i,e (actionId == 1 && actionName == "Create" ) as part of my Validation Script(i,e Add-on->Behaviours->Subsystem) written to map subsystem - module owner custom field value.

 

selectedComponents?.each { LazyLoadedOption it ->      
def issueFactory = ComponentAccessor.getIssueFactory()      
def issueManager = ComponentAccessor.getIssueManager()      
def newIssue = issueFactory.cloneIssue(issue)  ........................................  
 
Map newIssueParams = ["issue":newIssue] as MapIssue newIssue1 = issueManager.createIssueObject(currentUser,newIssueParams)  
 
--------------------  
 
}
import org.ofbiz.core.entity.GenericValueimport com.atlassian.jira.issue.customfields.manager.OptionsManagerFormField 
 
formComponent = getFieldById(fieldChanged)
FormField formSubcomponent = getFieldByName ("Module Owner")
FormField Release_Prime = getFieldByName ("Release Prime")
 
def actionName = getActionName()
def actionId = getAction().getId()
def componentFormValue = formComponent.getFormValue()
def componentValue = ""
def relPrimeVal="" 
 
if((actionId == null && actionName == null)||(actionId == 1 && actionName == "Create" )|| (actionId == 1431 && actionName == "Change Subsystem")|| (actionId == 1441 && actionName == "Clone PR") ||(actionId == 1321 && actionName == "Return Module Owner")|| (actionId == 1321 && actionName == "Return Module Owner")|| (actionId == 1341 && actionName == "Send to Engineering")|| (actionId == 471 && actionName == "To Architecture")|| (actionId == 481 && actionName == "To Closed")|| (actionId == 491 && actionName == "Test input required")|| (actionId == 1481 && actionName == "Reassign")|| (actionId == 1491 && actionName == "Reassign")|| (actionId == 771 && actionName == "Clone for All")|| (actionId == 811 && actionName == "Clone for All")|| (actionId == 871 && actionName == "Clone for All")|| (actionId == 911 && actionName == "Clone for All")|| (actionId == 971 && actionName == "Clone for All")|| (actionId == 1031 && actionName == "Clone for All")|| (actionId == 1251 && actionName == "Clone for All")|| (actionId == 1221 && actionName == "Clone for All")|| (actionId == 1201 && actionName == "Clone for All")|| (actionId == 1161 && actionName == "Clone for All")|| (actionId == 1121 && actionName == "Clone for All")|| (actionId == 1071 && actionName == "Clone for All") || (actionId == 711 && actionName == "Release Updated")|| (actionId == 1051 && actionName == "Release Update")|| (actionId == 781 && actionName == "Release Update")|| (actionId == 831 && actionName == "Release Update")|| (actionId == 861 && actionName == "Release Update")|| (actionId == 901 && actionName == "Release Update")|| (actionId == 961 && actionName == "Release Update")|| (actionId == 1011 && actionName == "Release Update")|| (actionId == 1271 && actionName == "Release Update")|| (actionId == 1231 && actionName == "Release Update")|| (actionId == 1191 && actionName == "Release Update")|| (actionId == 1151 && actionName == "Release Update")|| (actionId == 1091 && actionName == "Release Update") || (actionId == 1511 && actionName == "Release Update") || (actionId == 701 && actionName == "Restricted Update")|| (actionId == 751 && actionName == "Restricted Update")|| (actionId == 791 && actionName == "Restricted Update")|| (actionId == 851 && actionName == "Restricted Update")|| (actionId == 891 && actionName == "Restricted Update")|| (actionId == 941 && actionName == "Restricted Update")|| (actionId == 1001 && actionName == "Restricted Update")|| (actionId == 1261 && actionName == "Restricted Update")|| (actionId == 1241 && actionName == "Restricted Update")|| (actionId == 1181 && actionName == "Restricted Update")|| (actionId == 1141 && actionName == "Restricted Update")|| (actionId == 1101 && actionName == "Restricted Update")|| (actionId == 1081 && actionName == "Restricted Update")){ 
 
formComponent.setReadOnly(false) 
switch (componentFormValue) 
{  case "10030" : //Agent 
componentValue = "Platform-Support"     
relPrimeVal="Server-release"   
break     
 
case "10031" : //Automation tool   
componentValue = "automation"     
relPrimeVal="Server-release"   
break
 
case "-1" :   
componentValue = "kmadhu"     
relPrimeVal="Server-release"  
break 
............. .............  
}  
formSubcomponent.setFormValue(componentValue)    Release_Prime.setFormValue(relPrimeVal)
}
else
{    formComponent.setReadOnly(true)     
	Release_Prime.setReadOnly(true)
}  
 
/* The custom field "Module Owner" is defined as below in 'Add-on->Behaviours-> Module Owner' */ 
 
Field: Module Owner 
Optional (Require)
Readonly (Writable)
Shown (Hide)

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Marketplace Apps & Integrations

Webinar invitation: Generate custom Jira Cloud PDF reports and exports

Jira may be a staple part of your workday, but your colleagues, customers, business partners or an auditor might need information presented in a different format, that is easy to access and read. And...

64 views 0 1
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