Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Setting default value for Organizations using Scriptrunner Initialiser or Behaviour?

Has anyone had any success in setting the Organizations field on an open form using an Initialiser or Behaviour in ScriptRunner? Ideally I'd like to be able to automatically set the initial form value of the Organization that appears on the "Share with..." field in a customer Request Type, but I can't even get Scriptrunner to set the Organizations field on a form with a initialiser or behaviour.


Again, this is just about setting what value appears on the form, before it's been submitted; no issues validating or changing the Organizations field once the ticket has been submitted.

1 answer

0 votes

I had a similar requirement but I was never able to interact with the "Share with" options in the portal.

I ended up using a script listener. I don't remember why I chose that over a postFunction.

Unfortunately, that doesn't help with setting a default option that the user would then be able to override with their own selection, if desired.

You are correct.

In my case, I never have a reason to allow customers to leave their tickets private.
If the customer selects an organization to share to, I leave that selection it (useful if they have access to more than one). If they leave it blank (private) I add the default one.

You would need to create additional custom fields to let the customer choose what they want and use those selections in the script. 

Scriptrunner Behaviour is simply just not designed to interact with the "Share With.." control on the portal form since it's not a standard field.

It doesn't seem like it's designed to interact with the Organizations field in general - I can't set that field using a behavior in the regular portal either.

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events