How to Update Issue — Jira Connector for SSRS

Introduction

In this article we will delve deeper into Jira and SSRS integration, and will learn how to update issue. We are continuing from where we left off. By this time, you must have created ODBC Data Source and connected to Jira. So, let's not waste time and begin.

Use Query Builder to generate SQL query

  1. The first thing you have to do is open Query Builder:

    ZappySys API Driver - Jira
    Jira Connector can be used to integrate Jira and your defined data source, e.g. Microsoft SQL, Oracle, Excel, Power BI, etc. Get, write, delete Issues, Users, Worklogs, Comments just in a few clicks!
    JiraDSN
    Open Query Builder in API ODBC Driver to read and write data to REST API
  2. Then simply select the Issues table and Update operation.

  3. Continue by configuring the Required parameters. You can also set optional parameters too.

  4. Move on by hitting Preview Data button to preview the results.

  5. If you see the results you need, simply copy the generated query:

    Issues
    Update
    Optional Parameters
    IssueIdOrKey
    NotifyUsers false
    OverrideScreenSecurity false
    OverrideEditableFlag false
    Continue On 404 Error (When record not found) False
    Advanced Properties
    Continue On 404 Error (When record not found) False
    UPDATE Issues
    SET Summary = 'This is my summary'
       ,Description = 'Lot''s of stuff to describe'
       ,Labels = '[ "bugfix" ]'
       ,DueDate = '2029-10-10'
    --WHERE Id=1234   
    --WHERE Id='ISSKEY'   
    WITH (
    	IssueIdOrKey='ISSKEY', --or use Id in where clause 
    	Output=1,
    	NotifyUsers=0,
    	OverrideScreenSecurity=0,
    	OverrideEditableFlag=0,
    	ContinueOn404Error=0
    )'
    Query Builder
  6. That's it! You can use this query in SSRS.

Let's not stop here and explore SQL query examples, including how to use them in Stored Procedures and Views (virtual tables) in the next steps.

SQL query examples

Use these SQL queries in your SSRS data source:

How to UPDATE Issue

Updates an issue

UPDATE Issues
SET Summary = 'This is my summary'
   ,Description = 'Lot''s of stuff to describe'
   ,Labels = '[ "bugfix" ]'
   ,DueDate = '2029-10-10'
--WHERE Id=1234   
--WHERE Id='ISSKEY'   
WITH (
	IssueIdOrKey='ISSKEY', --or use Id in where clause 
	Output=1,
	NotifyUsers=0,
	OverrideScreenSecurity=0,
	OverrideEditableFlag=0,
	ContinueOn404Error=0
)'

How to UPDATE / Insert Issue with Custom Fields

Updates or Insert an issue with custom fields of various types (dropdown, radio, textarea .. so on)

UPDATE Issues
SET customfield_10050='[{"value":"AAA"},{"value":"BBB"}]'	--CUSTOM Checkboxes field update (Must use Raw JSON)
,customfield_10051='2020-12-31'	--CUSTOM Date field update
,customfield_10052='2020-12-31T23:59:59'	--CUSTOM DateTime field update

--Custom Dropdown / Radio fields
,customfield_10048_value='BBB'	--CUSTOM Dropdown field update (Using value - i.e. item label)
--OR--
--,customfield_10048_id='10022'	--CUSTOM Dropdown field update (Using id - i.e. item id)
--OR--
--,customfield_10048='{"value":"BBB"}'	--CUSTOM Dropdown (Using Raw value)

,customfield_10053='["bugfix","test"]'	--CUSTOM Labels field update (Must use Raw JSON)
,customfield_10057='[{"value":"AAA"},{"value":"BBB"}]'	--CUSTOM Listbox Multiselect field update (Must use Raw JSON)
,customfield_10049=123455555.123	--CUSTOM Number field update
,customfield_10054_text='Long string...line-1 
	Long string... line-2 
	Long string... line-3'	--CUSTOM Paragraph field update

,customfield_10055_value='BBB'	--CUSTOM Radio field update by value
--OR--
--,customfield_10055_id='10023'	--CUSTOM Radio field update

,customfield_10058='https://zappysys.com'	--CUSTOM Url field update
,customfield_10059_accountId="5dd64082af96bc0efbe55103" --CUSTOM User field update (update by accountId)
--OR--
--,customfield_10059='{"accountId":"5dd64082af96bc0efbe55103","displayName":"System"}'	--CUSTOM User field update --accountId=5dd64082af96bc0efbe55103
,customfield_10060='Custom text single line'	--CUSTOM text single line field 
,customfield_10001='577069e1-1bcd-4b1e-9070-0b2475830d1c'	--CUSTOM Team field update (update by Team Id)
--WHERE Id=10000
WITH (
	IssueIdOrKey='ISSKEY', --or use Id in where clause 
	Output=1,
	NotifyUsers=0,
	OverrideScreenSecurity=0,
	OverrideEditableFlag=0,
	ContinueOn404Error=0
)

--For INSERT use same values with same fields like below. For Insert you do not have to specify Id or Key
--INSERT INTO Issues(ProjectKey, IssueTypeName, Summary, Description, customfield_10050,....., customfield_10060) 
--VALUES ('SMP', 'Task', 'My ticket inserted through the API', 'A description about an issue', '[{"value":"AAA"},{"value":"BBB"}]' ,... 'Custom text single line')

'

How to UPDATE multiple Issues matching with JQL search query

Updates multiple issues which match with certain condition (JQL). Adding Where 1=1 or some other WHERE condition invokes Lookup endpoint (refer to other example to learn about JQL - see Search issues using Advanced JQL query expression)

UPDATE Issues
SET Summary = 'This is done on <<fun_now>>'
Where 1=1
WITH (jql='status=done' , ContinueOn404Error=0)
--WITH (jql='key in(10001, 10002, 10003)' , ContinueOn404Error=0)
--WITH (jql='key in(CS-1, CS-2, CS-3)', ContinueOn404Error=0)

How to Update Custom Option Field (Dropdown/Radio)

This example shows how to update a custom field of an issue by Option Value or Id (Of option entry item)

--(By value)        
UPDATE Issues 
SET customfield_10048_value ='BBB' --supply value (label) of dropdown/radio
WITH (IssueIdOrKey='10020')

--OR-- (By item ID)

UPDATE Issues 
SET customfield_10048_id =10023 --supply id of dropdown/radio item
WITH (IssueIdOrKey='10020')

--OR-- (Raw id)

UPDATE Issues 
SET customfield_10048='{"id":"10023"}' --supply raw json
WITH (IssueIdOrKey='10020')

--OR--  (Raw value)
UPDATE Issues 
SET customfield_10048='{"value":"BBB"}' --supply raw json
WITH (IssueIdOrKey='10020')

--OR--  (set null)

UPDATE Issues 
SET customfield_10048 =null 
WITH (IssueIdOrKey='10020')

How to Update Custom Multi Select / User / Team fields (RAW Json Update)

This example shows how to update a custom field of type array or other complex fiels like user

UPDATE Issues 
SET customfield_10048='[{"value":"AAA"}, {"value":"CCC"}]' --supply raw json
WITH (IssueIdOrKey='10020')

--OR-- 

UPDATE Issues 
SET customfield_10048 =null --set to null
WITH (IssueIdOrKey='10020')

update_issue endpoint belongs to Issues table(s), and can therefore be used via those table(s).

Stored Procedures and Views

Create Custom Stored Procedure

You can create procedures to encapsulate custom logic and then only pass handful parameters rather than long SQL to execute your API call.

Steps to create Custom Stored Procedure in ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here

  1. Go to Custom Objects Tab and Click on Add button and Select Add Procedure:
    ZappySys Driver - Add Stored Procedure

  2. Enter the desired Procedure name and click on OK:
    ZappySys Driver - Add Stored Procedure Name

  3. Select the created Stored Procedure and write the your desired stored procedure and Save it and it will create the custom stored procedure in the ZappySys Driver:
    Here is an example stored procedure for ZappySys Driver. You can insert Placeholders anywhere inside Procedure Body. Read more about placeholders here

    CREATE PROCEDURE [usp_get_orders]
        @fromdate = '<<yyyy-MM-dd,FUN_TODAY>>'
     AS
        SELECT * FROM Orders where OrderDate >= '<@fromdate>';
    

    ZappySys Driver - Create Custom Stored Procedure

  4. That's it now go to Preview Tab and Execute your Stored Procedure using Exec Command. In this example it will extract the orders from the date 1996-01-01:

    Exec usp_get_orders '1996-01-01';

    ZappySys Driver - Execute Custom Stored Procedure

  5. Let's generate the SQL Server Query Code to make the API call using stored procedure. Go to Code Generator Tab, select language as SQL Server and click on Generate button the generate the code.
    As we already created the linked server for this Data Source, in that you just need to copy the Select Query and need to use the linked server name which we have apply on the place of [MY_API_SERVICE] placeholder.

    SELECT * FROM OPENQUERY([LS_TO_JIRA_IN_GATEWAY], 'EXEC usp_get_orders @fromdate=''1996-07-30''')

    ZappySys Driver - Generate SQL Server Query

  6. Now go to SQL served and execute that query and it will make the API call using stored procedure and provide you the response.
    ZappySys Driver - Generate SQL Server Query

Create Custom Virtual Table

ZappySys API Drivers support flexible Query language so you can override Default Properties you configured on Data Source such as URL, Body. This way you don't have to create multiple Data Sources if you like to read data from multiple EndPoints. However not every application support supplying custom SQL to driver so you can only select Table from list returned from driver.

If you're dealing with Microsoft Access and need to import data from an SQL query, it's important to note that Access doesn't allow direct import of SQL queries. Instead, you can create custom objects (Virtual Tables) to handle the import process.

Many applications like MS Access, Informatica Designer wont give you option to specify custom SQL when you import Objects. In such case Virtual Table is very useful. You can create many Virtual Tables on the same Data Source (e.g. If you have 50 URLs with slight variations you can create virtual tables with just URL as Parameter setting.

  1. Go to Custom Objects Tab and Click on Add button and Select Add Table:
    ZappySys Driver - Add Table

  2. Enter the desired Table name and click on OK:
    ZappySys Driver - Add Table Name

  3. And it will open the New Query Window Click on Cancel to close that window and go to Custom Objects Tab.

  4. Select the created table, Select Text Type AS SQL and write the your desired SQL Query and Save it and it will create the custom table in the ZappySys Driver:
    Here is an example SQL query for ZappySys Driver. You can insert Placeholders also. Read more about placeholders here

    SELECT
      "ShipCountry",
      "OrderID",
      "CustomerID",
      "EmployeeID",
      "OrderDate",
      "RequiredDate",
      "ShippedDate",
      "ShipVia",
      "Freight",
      "ShipName",
      "ShipAddress",
      "ShipCity",
      "ShipRegion",
      "ShipPostalCode"
    FROM "Orders"
    Where "ShipCountry"='USA'

    ZappySys Driver - Create Custom Table

  5. That's it now go to Preview Tab and Execute your custom virtual table query. In this example it will extract the orders for the USA Shipping Country only:

    SELECT * FROM "vt__usa_orders_only"

    ZappySys Driver - Execute Custom Virtual Table Query

  6. Let's generate the SQL Server Query Code to make the API call using stored procedure. Go to Code Generator Tab, select language as SQL Server and click on Generate button the generate the code.
    As we already created the linked server for this Data Source, in that you just need to copy the Select Query and need to use the linked server name which we have apply on the place of [MY_API_SERVICE] placeholder.

    SELECT * FROM OPENQUERY([LS_TO_JIRA_IN_GATEWAY], 'EXEC [usp_get_orders] ''1996-01-01''')

    ZappySys Driver - Generate SQL Server Query

  7. Now go to SQL served and execute that query and it will make the API call using stored procedure and provide you the response.
    ZappySys Driver - Generate SQL Server Query

Update Issue in SSRS

We are at the point where we can reiterate on how to use the SQL query, Stored Procedures or Views in SSRS:

  1. Open Visual Studio and create a new SSRS project
  2. Then add a new Shared Data Source (you can create a non-shared data source inside report too):

    Adding a Data Source in SSRS project
  3. Continue with creating the Shared Data Source. Select Microsoft SQL Server as Type and hit Build button to proceed further:

    Configuring a Data Source to access API data in SSRS project
  4. Once a window opens, configure it similarly. Configure "JiraDSN" as database name. Finally, hit Test Connection and OK:

    JiraDSN
    Configuring thoroughly a Data Source to access API data in SSRS project
  5. Another window opens, and it should look similarly to this one below which ends the creation of a Data Source:

    DataSource=localhost,5000;Initial Catalog=JiraDSN
    How Data Source in SSRS project looks like
  6. Now it's time to create a Dataset. If you don't have a report created, in one of the wizard's steps it will look like this:

    SELECT * FROM Issues
    Specifying a query in SSRS Dataset to access API data #1
  7. Finally, once you complete the report, similar results will show up:

    ZappySys Data Gateway API data source results

More integrations

Other application integration scenarios for Jira

All
Data Integration
Database
BI & Reporting
Productivity
Programming Languages
Automation & Scripting
ODBC applications