Current situation:
Transition screen with a scripted field (issue picker) "Existing Reported Issue", and a 'normal' custom field "Public bug description":
Is it possible to auto-populate "Public bug description" based on the issue picked at "Existing Reported Issue"?
So, for example:
- chosen "Existing Reported Issue" has description "XYZ"
- Public bug description will be auto populated "XYZ"
- if another Existing Reported Issue is chosen, the Public bug description will be "overwritten".
If that's not possible, some kind of preview of the Description field is also fine.
Thanks!
Hi Berry,
You can achieve this with setFormValue() in Scriptrunner Behaviour.
Here's the sample script which is applied in Behaviour > Fields > (Your issue picker field):
def issuepicker = getFieldById(getFieldChanged())
def multitext = getFieldByName("Multi Text Field")
//Get the issue picker field's value
String issuepickerValue = issuepicker.getValue()
//To check the issue picker field's value in logs
log.error("issuepickerValue: $issuepickerValue")
if (issuepickerValue == "SUN-5") {
multitext.setFormValue("sun5")
}else if (issuepickerValue == "SUN-6") {
multitext.setFormValue("sun6")
}else{
multitext.setFormValue(null)
}
You can refer to this document for more information on adding a default description with Behaviour.
Hi JJ, thanks for the info!
However, I'm still a bit stuck in the implementation. Is it possible to have a quick screen share session?
Cheers, Berry.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Berry,
Apologies that we can't have a screen share session regarding the issue.
But you can attach the screenshots with the explanations on where you’re stuck with. I'll take a look at it when I'm available.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem. To be honest, I'm really a noob concerning Behaviours, so I "just" copy/pasted your script with minor adjustments. Not sure what to do next..
See the video at: https://transfer.avisi.works/index.php/s/WafL7wWi5jJSW2j
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're almost there. You'll need to change the "SUN-5" and "SUN-6" to the issue keys that have been selected in your Issue Picker field.
Just some minor changes for this part:
//If you've selected "RI-5162" in your issue picker field
if (issuepickerValue == "RI-5162") {
multitext.setFormValue("RI-5162 - test 23 dec 3")
}else if (issuepickerValue == "RI-5163") { //If you've selected "RI-5163" in your issue picker field
multitext.setFormValue("RI-5163 - test 23 dec 4")
}else{
multitext.setFormValue(null)
}
Also, in the Behaviour Mappings please choose "Use project/issuetype mapping" mapping type. The service desk mapping type should only trigger the behaviour on the customer portal.
Hope this help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Unfortunately I still do not see the expected behavour: https://transfer.avisi.works/index.php/s/PBa2jzigz3aEJeR
One more question as I don't exactly understand why/how I should change the mentioned issue key's in the script. Because it could be any random issue key that people will select in the field Existing Reported Issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In your screencast, I can see you're mapping to project "Reported Issues" and transition the status in the project "Uniface Service Desk".
Please try to map to the project "Uniface Service Desk" with "Use project/issuetype mapping" mapping type.
I don't exactly understand why/how I should change the mentioned issue key's in the script.
You'll need to give a condition/command in order to customize the default value for text field based on issue picker value. The issuepickerValue stored the selected issue picker field value. So when you have got this condition in your script:
if (issuepickerValue == "RI-5162") {
multitext.setFormValue("RI-5162 - test 23 dec 3")
}
If you've selected issue picker field with RI-5162, then the text field value is pre-filled with "RI-5162 - test 23 dec 3".
But I guess you wanted to auto-populate the text field value with same as the selected issue picker value. You can just remove the if-else condition and set the text field with issue picker field value.
import com.atlassian.jira.component.ComponentAccessor
def issuepicker = getFieldById(getFieldChanged())
def multitext = getFieldByName("Multi Text Field")
String issuepickerValue = issuepicker.getValue()
log.error("issuepickerValue: $issuepickerValue")
//Get selected issue's summary based on issue picker value
def relatedIssue = ComponentAccessor.issueManager.getIssueByCurrentKey(issuepickerValue as String)
//Set multi text field value with selected issue key and issue summary
multitext.setFormValue(issuepickerValue + " - " + relatedIssue.summary)
You can refer to Adaptavist Library for more information on set form field values from issue in picker.
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.