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 Champion
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 Champion
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
TAGS
atlassian, jira cloud certification, managing jira projects, jira project administration, jira cloud exam, atlassian certification, agile project management, jira workflows, jira permissions, jira training, jira cloud skills, atlassian learning

Become a Certified Jira Service Project Expert 🦸🏻‍♂️

Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.

Get Certified! ✍️
AUG Leaders

Atlassian Community Events