Forums

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

Upgraded to 8.18.2 and we have a bunch of scriptrunner scripts broken due to ComponentManager

Jeremiah Cargill August 23, 2021

How do I convert the Script that was working below?

 

import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.component.ComponentAccessor;
import org.apache.commons.lang.time.DateUtils;
import java.text.SimpleDateFormat;
import java.util.Date.*;

if (issue.isSubTask()){

SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/YYY");

def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Launch Date Site")
if (cf) {
def result = issue.parentObject.getCustomFieldValue(cf);
if (result){
return sdf.format(result);
} else {
return
}
}
return
}

return

1 answer

0 votes
Nic Brough -Adaptavist-
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 Leaders.
August 23, 2021

You've run into one of the things documented at https://scriptrunner.adaptavist.com/latest/jira/releases/UpgradingToJira8.html - that doc has lots of fixes for other things you may hit as well as this one.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events