Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Remove user from Organization with ScriptRunner automation rule

I don't have much experience with scripting so I want to ask if anyone has set up ScriptRunner automation rule for removing users from an organization or can recommend some approach.

2 answers

0 votes
Hana Kučerová Community Leader Jan 13, 2021

Hi @Brad Butchers ,

would you please provide more information? What is your situation and why and under which circumstances do you need to do such a thing?

Hi Hana,

The situation is if people leave a company they can complete a certain request type and it will automatically remove them from the organization

Cheers

Brad

Hana Kučerová Community Leader Jan 16, 2021

Hi @Brad Butchers ,

you can send DELETE request to the Service Management's API. Even though it is experimental, it worked for me, I just needed to provide additional header:

X-ExperimentalApi: opt-in

It is not clear from the documentation, but you need to provide list of usernames, which you want to remove from the organization. So the request body is the same as when you are adding users to the organization, something like:

{
"usernames": [
"username1",
"username2",
"username3"
]
}

Example of how to send request can be found here.

Excellent thanks, what would the script look like thought? I'm new to the groovy/java scripting for script runner but i did run these through postman and they work for me too.

For an automation rue to work firstly I would need to know how to get the username from a custom field to use as the user to remove. How would I do this?

Second would be to get the organization that user belongs too. How would I do this too?

Cheers

Brad

Hello,

We need this too. We have added the whole organization twice: with ".com" and ".net"
Now we should remove all users with ".com". Is this possible to do with script or somehow?

We use Cloud.

Thanks,
Max

Sorry if this is wrong topic. I have done my task via REST API. I created VBScript and deleted unused users (3600).

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
Community showcase
Published in Jira Service Management

Announcing Jira Service Management!

Hello there Cloud Community members! Today, we’re thrilled to announce Jira Service Management, the next generation of Jira Service Desk. Jira Service Management touts advancements in IT service ...

2,121 views 25 37
Read article

Community Events

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

Events near you