How to auto-fill Organizations field when raising request through JSM Widget
Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.
Summary
When raising a request via JSM Widget, if the user is a member of a customer organization, it won't be possible to share the ticket with their Org because the Widget doesn't have the option "Share with."
Solution
You can create an Automation Rule to verify every new ticket created if it was raised by the "Jira Service Management Widget" user and get the organization for the reporter.
- Create an automation rule by following the steps in the Create and edit Jira automation rules documentation.
- For the trigger, select "Issue Created".
- Add a new condition, select "User condition", then configure it as below:
- User: User who triggered the event
- Check to perform: is
- Criteria: Jira Service Management Widget (user)
- Add a new action, select "Send Web Request ," then configure it as below:
- Web request URL:
https://your-instance.atlassian.net/rest/servicedeskapi/organization?accountId={{reporter.accountId}}
Headers:
Field 1: Authorization - Basic <token>
Field 2: Accept - application/json
Note: You'll need to generate a token by following the steps in this documentation: Supply basic auth headers .
HTTP Method: GET
Web request body: Empty
Check " Delay execution of subsequent rule actions until we've received a response for this web request " (Important!)
- Web request URL:
Add a new action, select Edit Issue action, then configure it as below:
Click on "More options," and copy and paste the code below:
{ "fields": { "Organizations": [{{webResponse.body.values.first.id}}] } }