Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using ScriptRunner Post Function to set issue custom date based on other custom date field

Anthony Craiu
February 22, 2018

JIRA Version: v6.3.15 (JIRA Server)

Script Runner Version: 3.0.16

My Objective -

Add 1278 days (30 months) to a datepicker custom field "DateCF1" and store it to another custom date field, "DateCF2" with a post function. I don't want to change DateCF1, it is just the starting date for DateCF2.

}

I've "found" multiple solutions to this problem, none of which have worked. I don't know what I'm doing wrong.

I don't want to use a scripted field, as I'd like the project administrators to have the ability to edit DateCF2 after the transition, as needed.

My current approach has been "Add post function" -> "Script Post-Function" -> "Custom script post-function" -> "Inline script" ->

def dateField = getCustomFieldValue("DateCF1")
def number = 1278

result = dateField + number
setCustomFieldValue("DateCF2",new Date(result.getTime()))

Any help at all would be sincerely appreciated.

I don't have access to the log as I'm not a server admin, so my trial and error has been publishing the workflow and moving through the transition. 

Thank you in advance,

Craiu

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Steve Thornhill
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
March 24, 2022

This doesn't answer your query on the function of behaviours, but couldn't you achieve the same function by just using a validator on the workflow to check that Assignee has been changed?

Frank Winkler
March 24, 2022

Thanks Steve! I also thought of a validator at first. But the requirement is that the assignee should be set to "unassigned" when the transition screen is opened (and only in the screen's field). If I use a validator, I would set the assignee in the issue - and when the user closes the transition screen with Cancel it would stay "unassigned".

TAGS
AUG Leaders

Atlassian Community Events