Organization automation

I do not have experience with scripting, and not sure if this can be done by some add-in, so I want to ask if anyone of you has done something similar or can recommend some approach:

when a customer creates an issue in service desk portal, I want to be able (most likely with a post-function during transition) to get the domain out of his email, create Organization if not already existing and add the customer to it. If the Organization exists, just add the customer to it.I assume this has to be done via custom code. Any examples how?

During one transition in a Service Desk project, I am creating issue in other project. During this transition I want to copy the Organization from the Service Desk project and save it in other custom field in the other project.Do you know any Add-in that can do this? I am using the JIRA Misc Workflow Extensions, but it does not support the Organization field.

Hi Klime, Nice automation and a nice answer from Jon. We want to include an organisation example in our documentation for ScriptRunner for server and your first use case is really interesting.

I have a question though. What if the customer's email is a gmail or hotmail ? This will create a Gmail organization and if another customer with a gmail account creates an issue then you will end up having a Gmail organization and it's members being completely strangers.