Hi ,
I want to have a custom field that should generate number sequence starting from given value and iterate over next issue creation.
E.g Starting Value=4000
My first ticket in Project should have value 4001, TEST-2 as 4002, TEST-3 as 4003 and so on.
I tried to create using Scripted field in Scriptrunner but it is not working. Value are not stored in Scripted field, So i cant take value and add+1 for next ticket.
Could you help in generating sequence of numbers iterating over tickets using scriptrunner Behaviour or Scripted Field
import com.atlassian.jira.issue.Issue
import org.apache.commons.lang3.StringUtils;
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
def key=issue.getKey()
log.error(key)
def cctype = customFieldManager.getCustomFieldObject('customfield_1500')
LazyLoadedOption cctype_value=(LazyLoadedOption)issue.getCustomFieldValue(cctype)
String value=cctype_value.getValue()
log.error("Value"+value)
def startID = customFieldManager.getCustomFieldObject('customfield_1503')
def startvalue=issue.getCustomFieldValue(startID)
log.error("startvalue"+startvalue)
log.error(cctype_value.getClass())
log.error("Value1:")
if (value=="Development"){
log.error("Value2:")
def ccnid = customFieldManager.getCustomFieldObject('customfield_12501')
//def ccnid_value=issue.getCustomFieldValue(ccnid)
log.error("ccnid"+ccnid)
return (8000).toString()
//String stringToConvert = String.valueOf(ccnid_value);
//Long convertedLong = Long.parseLong(stringToConvert);
// log.error(convertedLong)
// return (convertedLong+1l).toString();
}