Setting default value for Organizations using Scriptrunner Initialiser or Behaviour?

kevin March 17, 2021

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
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 18, 2021

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.

kevin March 23, 2021

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.

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 23, 2021

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.

kevin March 26, 2021

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
TAGS
AUG Leaders

Atlassian Community Events