scriptrunner-public-sorin /src/test/resources/examples/misaac.groovy

Language Groovy Lines 43
MD5 Hash 2bdbba6094ecc1171a8bdee8bffbc7dc
Repository https://bitbucket.org/sorin/scriptrunner-public-sorin View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.fields.FieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutManager;
import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem;
import com.atlassian.jira.issue.fields.layout.field.EditableFieldLayout;

//*** Initialize Output ***
String result = "";

//*** Get Needed Managers ***
ComponentManager   componentManager = ComponentManager.getInstance();
FieldLayoutManager layoutManager    = componentManager.getFieldLayoutManager();
FieldManager       fieldManager     = componentManager.getFieldManager();

//*** Lookup Field Layout ***
EditableFieldLayout layout = layoutManager.getEditableFieldLayout(10000);
log.debug(layout)

//*** Lookup Custom Field ***
CustomField     field = fieldManager.getCustomField('customfield_10042');
FieldLayoutItem item  = layout.getFieldLayoutItem(field);

log.debug(item)


//*** Record Old Description
result += "Old Description:\n----------------\n"
result += item.getFieldDescription();
result += "\n\n";


//*** Update Field Description ***
layout.setDescription(item,"SSSSew Field Description");
layoutManager.storeEditableFieldLayout(layout)


//*** Record New Description ***
result += "SSSNew Description:\n----------------\n";
result += item.getFieldDescription();
result += "\n\n";

return result;
Back to Top