I'm running Scriptrunner with Jira Service Desk to create a application portal for a system called "PBS".
In my portal, I want to make a read-only select field called "System", and set the default value to "PBS" so I could use this field later in a database-picker.
However, when I try to get the value of this read-only field with the following code:
It always return null. If I comment out the line which makes the "System" field read-only, it works normally.
Could anyone please tell me if this is by design or a bug?
Thank you for your reply. By "making the "System" field read-only" I mean:
So the user can see the field and its default value, but cannot edit it.
Edit: Sorry, wrong code above. I meant:
Ok. It seems you are scripting a behavior ? Please give more context when you describe a "problem" !
Are you creating the issue ? Then the custom field does not contain the value yet, it is still only in the form field on the screen... In that case it is "logic" that your line returns null.
Please provide a bigger part of your script and context. with some parts of lines it it hard to understand what you are doing...
Yes, I'm scripting a behaviour for a field in the issue creation screen.
I don't know if what you described is true, because I'm able to get the value of the field with the exactly same code when the field is not read-only. The code only returns null when the field is read-only.
Again, it really depends how you have written your code, so as long as you do not (want to) share more details, it is hard to guess.
In "normal" cases, when you create (or edit) an issue, the fields you modify are not yet saved to the issue, you find the values only n the form fields (thats why there is a method to get the value from the form field).
Only after saving it to the issue, you can count to find the values in the issue (getCustomFieldValue); But again, you can of course "fiddle" in your code and write yourself to the issue ...
Hello Community! I hope you've been enjoying the 🍂Apptoberfestivities🍂 (I know I have!) The event is heating up next week with a series of virtual events that we're calling the 🍻🍂Partner App ...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events