Hi Community,
I want to set a pre-filled value in Summary and Description when opening the Create Screen using Scriptrunner for Jira Cloud.
I am passing the below command when initial page load and field is updated and on Create View.
getFieldById("summary").setValue("Initiative Name")
getFieldById("description").setValue("Problem Statement")
But it is giving me Required Field Validation when I click on Create button on Create screen
Please guide what could the appropriate code to prefill the Summary & Description values using scriptrunner
Or any other workarounds?
Thanks
Hi Digvijay,
There are two issues with your script which are:
1. It should be getFieldById, but you have written getFielById, which spells it wrong, which means the script will not work.
2. To set the description you need to use the Atlassian Document Format and we have an example here which shows how to set the description. You can use the Atlassian Document Format Builder to create the Atlassian Document Format to put in the script.
If after changing these two, then you are still having issues can you please provide the information Trudy asked for so we can see if a validator is blocking the issue creation.
I hope this helps.
Regards,
Kristian
Hello @Digvijay Singh
Do you see the specified content appearing in the fields in the Create Issue dialog?
Can you provide a screen image of the error message that you get?
There may be a Workflow Validator that is requiring you to set other fields as part of the issue creation process. Have you examined the Create transition in the workflow that applies to that issue type in that project, checking to see if it has any Validators?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I thoroughly checked if there is any validators are added to Create transition but thay are not
Please find the below screenshots
I tried everything in script runner behavior, create transition but I am still getting this required field validation for Summary and Description system fields on Create Dialogue.
Please guide further.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kristian Walker _Adaptavist_
Please find the above screenshots. And yeah, it was a typo mistake in my description - corrected now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Digvijay,
Please can you set the description using Atlassian document format as I suggested as the code you have is currently invalid and this is why you are getting this error as it is not populating the description field.
If you click the examples Button and select the example named Set default text in Description field this will give you the correct code to set the description field using Behaviours in Jira Cloud.
Regards,
Kristian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Kristian Walker _Adaptavist_
Thank you sharing that example code link, I am able to set prefill value in Summary & Description on Create View successfully.
One more request, what if I remove Summary & Description fields from Create screen but I still need to prefill Summary and Description (from backend)?
The purpose of removing the Summary & Description from Create View is that I only want to show Initiative Name field and Problem Statement field and not Summary & Description.
Once user has entered the value in Initiative Name and Problem Statement custom fields on Create View, the values of these fileds should be copied to Summary & Description after issue creation and should reflect in Summary & Description in Issue View and Transition View.
However, to the above request, I am able to hide Summary and Description by running below
getFieldById("summary").setVisible(false)
after adding them to Create View, but it is taking too much time to load the behavior on Create View and to avoid this delay to appear to user, I placed them at the bottom of the create screen.
Could you also provide any workaround to achieve my second request?
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Digvijay,
Can you please raise a support request with our support team here and they will be able to debug these issue further for you and assist you with these.
Regards,
Kristian
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.