Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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 Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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!


Custom date field (Action Due date) needs to update the custom text field(Action due week)e.g. 16W07

I am already having the same function with Fields Due date and Release Week

If I update due date with 2019-03-08 the Release Week updates as 1910:5

Same requirement I need with Custom date field (Action Due date) needs to update the custom text field(Action due week)e.g. 16W07

Here we are using the custom script:

import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.ModifiedValue;
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder;
import java.sql.Timestamp;
//import java.util.calendar.*;
//import java.text.SimpleDateFormat;
if(issue.getProjectObject() != null)
if(issue.getProjectObject().getId() != 11016)
{//Update ReleaseWeek with week Except for WH-PCR Project
Date date = issue.getDueDate();
String relYearWeek = "";
Calendar calUK = Calendar.getInstance(Locale.UK);
//Calendar calUS = Calendar.getInstance(Locale.US);
//if(date != null)
// calUS.setTime(date);

String dueDateYearUK = calUK.getWeekYear().toString().substring(2);
String dueDateWeekUK = calUK.get(Calendar.WEEK_OF_YEAR).toString();
String dueDateDayOfWeekUK = calUK.get(Calendar.DAY_OF_WEEK).toString();
String dayOfWeek = "";
dayOfWeek = ":1";
else if(calUK.get(Calendar.DAY_OF_WEEK)==Calendar.TUESDAY)
dayOfWeek = ":2";
else if(calUK.get(Calendar.DAY_OF_WEEK)==Calendar.WEDNESDAY)
dayOfWeek = ":3";
else if(calUK.get(Calendar.DAY_OF_WEEK)==Calendar.THURSDAY)
dayOfWeek = ":4";
else if(calUK.get(Calendar.DAY_OF_WEEK)==Calendar.FRIDAY)
dayOfWeek = ":5";
else if(calUK.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY)
dayOfWeek = ":6";
else if(calUK.get(Calendar.DAY_OF_WEEK)==Calendar.SUNDAY)
dayOfWeek = ":7";

//relYearWeek = calUK.getWeekYear().toString().substring(2) + dueDateWeekUK.padLeft(2, "0") + ":" +;
relYearWeek = dueDateYearUK + dueDateWeekUK.padLeft(2, "0") + dayOfWeek;//":" + dueDateDayOfWeekUK;

// String dueDateWeekUS = calUS.get(Calendar.WEEK_OF_YEAR).toString();
// String relYearWeekUS = calUS.getWeekYear().toString().substring(2) + dueDateWeekUS.padLeft(2, "0");
// return "EU:" + relYearWeek + ", US:" + relYearWeekUS;
// relYearWeek = "EU:" + relYearWeek + ", US:" + relYearWeekUS;
def cfManager = ComponentAccessor.getCustomFieldManager();
def relWeek = cfManager.getCustomFieldObjectByName("Release Week");
if(relYearWeek != "" || (relYearWeek == "" && issue.getCustomFieldValue(relWeek).toString() != ""))
relWeek.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(relWeek), relYearWeek), new DefaultIssueChangeHolder());


If I am replacing the Date date = issue.getDueDate(); with Action Due Date I am getting an error


0 answers

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events