This script adds all Organisations for a User to a Ticket that is being created in Jira service Desk - Created via JIRA, not the Portal. It uses the Reporter.
Notice, a User can belong to several Organisations, all will be added to the Ticket:
Find v4.x of the script here
Thanks to Adaptavist for the Script
Notice the LimitedPagedRequestImpl(0, 100, 500) lines, if the numbers are to small, nothing will be returned
This is a potential expensive call, if You have a lot or organisations, currently I have a customer with 600 Orgs, and the script takes 3-5 seconds to execute. So we had to change the idea of a scripted field to another solution, as each Issue view took 5-6 seconds.
I assume this will be better in JIRA 8 where the "Atlassian Fugue" is replaced by a proper API: https://confluence.atlassian.com/servicedesk/jira-service-desk-4-0-x-release-notes-961777466.html
Not working for JIRA 8.x