The output should be a table (in issue description):
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption
import com.atlassian.jira.component.ComponentAccessor;
customFieldManager = ComponentAccessor.getCustomFieldManager();
def customField_4 = customFieldManager.getCustomFieldObjectByName("Processing")
def myCustomFieldValue = issue.getCustomFieldValue(customField_4)
def customFieldValue_4 = myCustomFieldValue != null ? ((LazyLoadedOption) myCustomFieldValue).getValue() : null
def valueToStringMap = [
"PAYIN":"Payin",
"QW":"qw_pull"
]
if (valueToStringMap.containsKey(customFieldValue_4)) {
customFieldValue_4 = valueToStringMap.get(customFieldValue_4)
}
def description_text_1 = '||Contract||Value||\n'
description_text_1 += '|code type|'+customFieldValue_4.toString()+'|\n'
if(issue.description) issue.description = description_text_1 + issue.description
else issue.description = description_text_1
But the code doesn't work for some reason :(
@Alex Koxaras _Relational_ , please, can you help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Alex
What is the result you are getting? What do you mean it doesn't work? Is there any error on your code, or simply the table isn't populated in the description? Or the table isn't in the correct format?
And where do you place this code? On a listener?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Alex Koxaras _Relational_
on the "create issue" screen, I select the Processing field and select option (payin or QW) there, depending on the choice, the value should be written to the table (description), I write the code in post funcrtion
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Koxaras _Relational_ I choose option "QW" (in Cf) , but for some reason it writes "nulll" in the table and not qw_pull , as by condition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the same thing on a DC instance, with the latest script runner, and within the Clone prebuilt listener, and it seems to work well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this table created in a clone of issue ? it's just that I have it (table) in the clone is created (issue link cloned by)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex when does this clone listener is triggered? In which events? And how exactly you want it to work?
I mean you have a parent issue (e.g. PAR-1). When you edit this issue, then this issue gets cloned and created PAR-2 as a task with the table as the description
Is the above statement correct? If not, kindly clarify.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Koxaras _Relational_ my workflow
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Koxaras _Relational_
steps: I fill in the fields when creating a task in mine (qpartner project), then after pressing the "creat" button, the task is automatically escalated to (TSP project) and a value table is automatically created in it based on what we filled out earlier
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex thank you! I managed to reproduce your error and I get a null as well. Let me try something and get back to you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex Koxaras _Relational_ Yes of course thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex here's the deal:
When creating the issue, most likely the system (even if you move the PF after the reindex) didnt update the Processing field value. This result in a null value, even from the very beginning. That's why you are getting the null on your table.
Now, I would consider two alternative to this:
Let me know if the above are clear.
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please show on the screenshots? otherwise I do not quite understand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Show up and give back by attending an Atlassian Community Event: we’ll donate $10 for every event attendee in March!
Join an Atlassian Community Event!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.