Behaviours Plugin Question - Behaviour when cloning

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

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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Bridget Sauer
Published Thursday in Marketplace Apps

Calling all developers––You're invited to Atlas Camp 2018

 Atlas Camp   is our developer event which will take place in Barcelona, Spain  from the 6th -7th of   September . This is a great opportunity to meet other developers and get n...

364 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you