Behaviours Plugin Question - Behaviour when cloning

clem
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 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 _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 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 January 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
TAGS
AUG Leaders

Atlassian Community Events