Hi,
We have created three scripted fields in Jira server which is working fine and we want to implement the same in Jira cloud however the same script does not work in cloud. Can someone help me modify the scripts ?
// Displays the sum of all story points for the Feature provided during Sprint planning.
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
int totalSP = 0
int SP
customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Sprint Estimate for Epic");
//log.debug("${customField.id}")
issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->
log.debug("Link of type ${issueLink.issueLinkType.name} from ${issueLink.sourceObject} to ${issueLink.destinationObject}")
log.debug("${issueLink.destinationObject.getCustomFieldValue(customField).toString()}")
if(issueLink.issueLinkType.name.contains('Consists of')) {
SP = issueLink.destinationObject.getCustomFieldValue(customField) ?: 0
totalSP += SP;
}
}
return totalSP;
------------------------------------------------------------------------------------------------
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.component.ComponentAccessor;
def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def cfManager = ComponentAccessor.getCustomFieldManager()
//def log = Logger.getLogger("com.onresolve.jira.groovy")
//log.setLevel(Level.INFO)
double totalSP = 0
customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Completed Story Points");
//log.debug("${customField.id}")
issueLinkManager.getOutwardLinks(issue.id)?.each {issueLink ->
// log.debug("Link of type ${issueLink.issueLinkType.name} from ${issueLink.sourceObject} to ${issueLink.destinationObject}")
// log.debug("${issueLink.destinationObject.getCustomFieldValue(customField).toString()}")
if(issueLink.issueLinkType.name.contains('Consists of')) {
def SP = issueLink.destinationObject.getCustomFieldValue(customField) ?: 0
totalSP += SP
}
}
//log.info("Closed ${j} of ${i}");
return totalSP
---------------------------------------------------------------------------------------------
Jira Cloud and Server are two very different applications, and hence, so is Scriptrunner on the two platforms.
You can't "convert" a script, or even most of the settings from one to the other, you will have to re-implement what you are doing in the way the new platform needs to do it.
Start with a read through https://docs.adaptavist.com/sr4js/latest/scriptrunner-migration/migrating-to-or-from-cloud/migrate-from-scriptrunner-for-jira-server-to-cloud
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.