Hi everyone,
Hope this question finds you well.
I have set up a behaviour script in Create screen, which when a user selected a custom field, the system field will show the predetermined value which have been set.
For example, when i chose A in the custom field, the system field will show B value.
If i chose the system field value manually, the issue will be created with the manual value. This is intended as well.
However, after the issue gets created, when I click the Edit button on the View issue screen, the system field value is showing the predetermined value as per script.
How to persist the system field value in the Edit screen?
And if the user decides to change the custom field value on the Edit screen, the system field value should behave as per script that have been set.
Should more info needed, please let me know.
Here is the current script that I wrote in ScriptEditor:
def maps =
[
"hello": ["1", "2", "3"],
"goodbye": ["4", "5", "6"]
]
void setSystemFieldValue(){
FormField ffSystemField = getFieldByName("System ")
FormField ff_CustomField = getFieldById(customfield_id)
String CustomFieldValue = ff_CustomField.getFormValue()
// This if/else will persists the value that gets created in Edit screen
// Start
if (!ffSystemField.getFormValue()){
ffSystemField.getFormValue()
}
// End
// This if/else will set the system field value when choosing the custom field value
if (CustomFieldValue in maps){
ffSystemField.setFormValue(maps[CustomFieldValue])
} else {
ffSystemField.setFormValue("-1")
}
}
Any pointers is greatly appreciated!