We recently migrated from Jira server to cloud, which broke some of our custom post-functions. That was completely expected, but I am having trouble recreating an autoincrement post-function that we had in our server instance.
The post-function increases the value of a numeric custom field by 1. Below is the script we used in server.
Does anyone know how to translate that script into cloud-speak? I have limited technical chops and have not been able to find a solution in the forums. Thanks in advance for any ideas or guidance.
// import com.atlassian.jira.issue.CustomFieldManager
// import com.atlassian.jira.issue.fields.CustomField
// import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
// import com.atlassian.jira.component.ComponentAccessor
// import com.atlassian.jira.issue.ModifiedValue
//
// String customFieldName = "Custom field name"
// DefaultIssueChangeHolder changeHolder = new DefaultIssueChangeHolder()
// CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
// CustomField cf = customFieldManager.getCustomFieldObjectByName(customFieldName)
// Double currValue = (Double)cf.getValue(issue)
// Double newValue = currValue+1
// cf.updateValue(null, issue, new ModifiedValue(currValue,newValue), changeHolder)