Forums

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

Set Due Date: Workflow Post Function: Script Post-Function: Custom Script post-function

Kiran_Kumar August 27, 2019

I have created a custom script post-function to update the system field, Due Date and it's the first function in the list of post functions and yet it does not update the date.

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp

MutableIssue getIssue = issue;
def reporter = issue.getReporterId();

if (reporter == 'abc@xyz.com') {
getIssue.setDueDate(new Timestamp((new Date() + 30).time));
}

Could anyone let me know what I'm doing wrong here? 

1 answer

1 vote
Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 27, 2019

Hi @Kiran_Kumar,

You can try below script by validating username, it did work for me

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import java.sql.Timestamp

if(issue.getReporter().name == "username-in-jira") {
issue.setDueDate(new Timestamp((new Date() + 30).time));
}
Kiran_Kumar August 28, 2019

@Leo The script I have written works without any errors but the due date is not updated to the new date.

Anyways, I have tried your way as well, it does not work.

Leo
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 28, 2019

Hi @Kiran_Kumar,

You mean, Due date itself is not getting updated from EMPTY? or it still holds the old value?

If  you are not seeing Due Date in issue page, then would suggest you to check the field availability in View screen

Kiran_Kumar August 30, 2019

It is not an issue with the screen. 

Like • Geoffrey Melle likes this

Suggest an answer

Log in or Sign up to answer