Thank you for your question.
I can confirm that to set a field which is not on the screen inside of ScriptRunner for Jira Cloud that you need to specify a query string paramater to override screen security and to allow the rest call to set a field which is not on the screen.
I can confirm that we have an example script inside of the documentation page located here which shows how you can use the .queryString("overrideScreenSecurity", Boolean.TRUE) paramter to set a field which is on screen.
Please note that when running this using paramater that your script must be run as the ScriptRunner Add-On User as only this user is allowed to set fields which are not pressent on the issue screens.
If this response has answered your question can you please mark it as accepted so that other users can see it is correct when searching for similar answers.
For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...
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