Jira Spoke - Create Issue action - Error occurred while fetching projects
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2024 08:09 PM
I'm setting up a bi-directional integration with Jira and just started testing the connection. The Spoke is already installed and the Connection and Credential have been setup (using Basic Auth with API Key).
When I tried using the 'Create Issue' Jira action from the flow, there are no Projects available and throwing an error 'Error occurred while fetching projects'. The Jira admin confirmed that there are Projects available in the Jira Sandbox instance and the service account has a product admin permission.
In the Connection, I tried both server type 'cloud' or server. Still not working.
Is this a Spoke related issue or it has something to do with the credential? Does the service account needs a 'site admin' permission to allow connection to ServiceNow?
I'm not sure what I'm missing. Any assistance is greatly appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 06:06 AM
Hey @Roan Galang,
I have a few questions:
- Is your Jira Admin seeing any errors on their end?
- For your connection, did you configure it with an HTTP Connection type and the connection attributes for Server Type & API Version?
- How are you triggering the 'Create Jira Issue' Flow/Action?
Thanks!
Josh Pirozzi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2024 05:35 PM
Hi @Josh Pirozzi - see answers below.
- Is your Jira Admin seeing any errors on their end? - I will ask the admin
- For your connection, did you configure it with an HTTP Connection type and the connection attributes for Server Type & API Version? - Yes, I used HTTP Connection, the server type is cloud, the api version is 2.
- How are you triggering the 'Create Jira Issue' Flow/Action? - To test I just used on Create/Update incident. And even without the trigger, I can't even save the flow. There are no available Project ID dropdown. The moment I selected 'Create Issue', it prompts me that error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2024 08:34 AM
Hi @Roan Galang,
Thanks for the answers!
To provide insight into how we have our 'Create Jira Story' Flow configured:
Task/Incident Form Field
- We added a Reference Field onto our SC_Task Table for 'Jira Project'.
- This gave us our Trigger point and provided the Jira Project (Group) Name to associate between ServiceNow and Jira.
- We also added a Single Line Textbox for the returned Jira Story Number. This will be fed back on a successful Jira Story Creation.
Flow Trigger
- The Trigger is then where a Task is updated and:
- Task Type = Catalog Task
- Jira Project is not empty
- Run trigger once
Flow Steps
- Wait for Condition:
- Wait for the Jira Project field to not be empty
- Look up Record:
- Look up the SC_TASK Record where the SysID matches the SysID of the SC_TASK in the Trigger.
- Get Task Variables Action:
- This will capture the specified Fields that we want to relay from the ServiceNow Record to the Jira Story.
- Input:
- Label & Name: sc_task_number
- Type: String
- Add a 'Script Step'
- Input Variables:
- Name: sc_task_number
- Value: Drag from the right panel for the input
- Script:
- See attachment
- Output Variables:
- Label & Name: description
- Type: String
- Mandatory: True
- Input Variables:
- Outputs:
- story_description: Drag from the Script Step > Description into this field.
- Once the Action is created & added to your Flow, you'll be able to associate the Record SysID into the available field.
- Update Jira Action: **This is where the JSON is built / connection with Jira happens** (You may/may not need all of these fields)
- Inputs:
- Label & Name: prj_key / Type: String
- Label & Name: task_id / Type: String
- Label & Name: assignment_group / Type: String
- Label & Name: ritm_id / Type: String
- Label & Name: story_id / Type: String
- Label & Name: task_status / Type: String
- Label & Name: req_for / Type: String
- Label & Name: description / Type: String
- Label & Name: summary / Type: String
- Label & Name: priority / Type: Choice
- Script Action (Set Priority)
- Input Variables: Name = priority / Value = Drag from Priority from the Inputs
- Script: See attached 'Set Priority' Script
- Output Variables: Label/Name = Priority / Type = String / Mandatory = True
- Script Action (Build JSON) **Jira fields potentially have 'Custom Fields' or 'Field ID's' that your data will be mapped to.
- Input Variables: See attached 'Build JSON Request - Input Variables'
- Script: See attached ' Build JSON Request - Script'
- Output Variables: Label & Name = json_body / Type = JSON / Mandatory = True
- Rest Step **This is where you'll pull your Connection Credential for Jira**
- See the 'Update Jira - Rest Step' attachment
- Script Step (Parse Response)
- Input Variables & Script - See the 'Update Jira - Parse Response' Attachment
- Output Variables:
- Label & Name = story_key / Type = String / Mandatory = True
- Label & Name = story_id / Type = String / Mandatory = True
- Outputs
- See 'Update Jira - Outputs' Attachment
- Once the Action is created & added to your Flow, you'll be able to associate the Record Fields into the available fields.
- Inputs:
- The final aspects we have included in the Flow is to Check the HTTP Status Code. If it's a successful Status Code, then it moves forward with updating the 'Jira Story' Single Line Textbox Field on the ServiceNow Record (see above).
- This is an 'If' Statement
- Condition 1: Drag from Flow Step 4 for the http_status_code IS 201
- OR
- Condition 2: Drag from Flow Step 4 for the http_status_code IS empty
- Update Record:
- This will be the Record looked up in Flow Step 2
- We update the Jira Related Fields to pass the Jira Story number back to the Record.
- Update Record:
- ELSE
- Update Record:
- Clear the Jira Project (Group) Field
- Update Record:
- Condition 1: Drag from Flow Step 4 for the http_status_code IS 201
- This is an 'If' Statement
Configuring it this way will help with providing the HTTP Status Code and determine when/if the Flow / Connection Fails.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-05-2024 06:43 PM
Hi @Josh Pirozzi appreciate the effort of sharing this.
This issue is now resolved. The reason why I'm getting this error is due to the IP address being rejected because it is not on the allowed list. The Jira admin has whitelisted the IP of the instance and now I can see all the Projects available in the Project ID field.
How I got the IP address error - I tried using the Jira action 'Look up Projects'. When I tested the flow, it prompted me "The IP address has been rejected because it is not on the allowedlist. See your admin for more information."
But will definitely refer to your scripts as well. It might be helpful on the mapping. Thank you so much.