cancel
Showing results for
Did you mean:
See all
##### Top groups
Explore all groups

## Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user

Level 1: Seed

25 / 150 points

Next: Root

## Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

What goes around comes around! Share the love by gifting kudos to your peers.

## Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

# How can I increment a custom field based on days elapsed since created date?

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