I have this script to calculate a custom field. I want to increment 'customfield_12331' by 1 as every 7 days go by. Is this possible?
def input1CfId = 'customfield_12326' def input2CfId = 'customfield_12327' def input3CfId = 'customfield_12328' def input4CfId = 'customfield_12329' def input5CfId = 'customfield_12331' def outputCfId = 'customfield_12330' def projectKey = "MS" if (issue == null || issue.fields.project.key != projectKey) { logger.info("Wrong Project ${issue.fields.project.key}") return } def input1 = issue.fields[input1CfId] as Integer def input2 = issue.fields[input2CfId] as Integer def input3 = issue.fields[input3CfId] as Integer def input4 = issue.fields[input4CfId] as Integer def input4 = issue.fields[input5CfId] as Integer if (input1 == null || input2 == null || input3 == null || input4 == null) { logger.info("Calculation using ${input1}, ${input2}, ${input3}, and ${input4} was not possible") return } def output = input1 + input2 + input3 + (input4/2) + input5 if (output == (issue.fields[outputCfId] as Integer)) { logger.info("already been updated") return } put("/rest/api/2/issue/${issue.key}") //.queryString("overrideScreenSecurity", Boolean.TRUE) .header("Content-Type", "application/json") .body([ fields:[ (outputCfId): output ] ]) .asString()
Thank you
- Drew Nedderman
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.