/
Order Burger using POST method function to call to Jira Asset API

Order Burger using POST method function to call to Jira Asset API

Introduction

A burger shop order management uses an external data source to collect the menu that burger shop will propose to customers. Burger shop uses Jira Asset to manage their menu and uses Customer Portal to receive orders from customers. Then each issue in the Jira project will be an order.

In order to use the data from an external data source, you will have to use an external database system such as: MySQL, Postgres, SQL Server, etc. In this example, we will use REST as our external database system.

image-20241007-044313.png

Prerequisites

  • User logged into their account, installed Table Grid Next Generation App

  • User created a related Jira project and issue

  • User had the admin role on Jira

  • User had Premium plan on Jira Service Management to use Jira Asset

Post-condition

  • User can use the grid to update related information for the list of items

  • User can use the Order Burger grid on issue and request form

  • User can download/upload the Configuration for personal usage

  • User can add more columns to support the order management such as: total, amount,..

Conditions

  • Required fields are marked with a red asterisk *

  • With Table Grid Next Generation, you can add formulas either in a separate column or use them to summarize other columns. You just enter the formulas directly in the built-in JavaScript Editor, and the grid will show the results. It processes the formula logic and displays the output in real-time. There are two main types of formula errors:

#error - syntax error

#type - operation error (operation could not be executed using different column types)

  • Each grid must contain at least 1 column, or else it will show the pop-up message “table-config-column-config-required”

Usecase Flow Diagram

Manage Menu in Jira Asset

  1. Open Jira Asset by clicking on “Asset” on Navigation bar

image-20240918-032116.png
  1. Create schema named “Burger Menu”

    1. Click on “Create schema”

    2. You can choose from a template or create a blank schema

    3. Fill all required information

    4. Click on “Create”

image-20240918-032332.png
  1. Create object type named “Dishes”

    1. Click on “Add object type”

    2. Fill all required information

    3. Click “Create”

image-20240918-034333.png
  1. Create attributes “Price”

    1. Open tab “Attributes”

    2. Type attribute name “Price”

    3. Select Type = Default and Type Value = Float

    4. Click “Add” to add attribute

image-20241007-113037.png
  1. Create objects

    1. Click on “Create object”

    2. Fill all required information

    3. Click on “Create”

image-20240918-035101.png
image-20241007-112820.png

Finally, we have a menu like below.

image-20241008-043837.png

Configure Data Source “Burger Menu”

Actions

Actions

1

Click Add Data Source in Data Source

2

Enter name “Burger Menu”

image-20240918-041229.png
3

a. Datasource Type:
Select Datasource Type = REST

b. URL: fill your REST API

How to have REST API URL: Assets REST API guide

c. Authorization:

  • Select “BASIC”

  • Username: your Jira username

  • Password: your API Token

d. Key = “Accept”

e. Value = “*/*”

f. Method = POST

image-20240918-041716.png
4

Body to query:

{ "qlQuery": "objectType = Dishes" }
image-20240918-043004.png
5

Click Test Connection to check the connection between data source and Jira

6

Click Save to save the Data Source configuration

Create Request Type “Order Burger”

  1. Open your Project, click on Project settings

image-20241007-035215.png
  1. Click Request types

image-20241007-035442.png
  1. Click Create request type

image-20241007-033958.png
  1. Fill in all required field and click Add

image-20241007-034218.png

 

Configure Grid “Order Burger”

Basic Flow

Actions

Actions

1

Click Add Grid

image-20241007-024022.png
2

Select Grid fields (to populate data manually)

Click Confirm

image-20241007-024125.png
3

Fill information for Name = “Order Burger”

4

In Scopes, select your Projects, Issue Types and Service Desk Request Types on which you want to display the grid

image-20241007-035000.png
5

In Configuration - Column, click image-20240516-020049.png to create new column

6

In Add Column, choose Sequence in Column type

User fill information for Identifier and Title

Type “jseq“ as Identifier and type “No.” as Title

image-20241007-034709.png

Click Add to save the information

7

In Configuration - Column, click image-20240516-020049.png to create new column

8

In Add Column, choose Single Select List in Column type

User fill information for Identifier and Title

Type “jname“ as Identifier and type “Name” as Title

image-20241007-025215.png

In Option attributes, click + and type “attributes”

image-20241007-025414.png

In Dynamic options, choose “Burger Menu” for Data Source

Type the JSON Path query:

$.values[*]
image-20241007-030011.png

Click Get data

In Mapping:

  • For “label”, choose “label”

  • For “attributes”, choose “attributes”

image-20241007-030134.png

Click to save the Dynamic options

Click Add to save the information

9

In Configuration - Column, click image-20240516-020049.png to create new column

10

In Add Column, choose Formula in Column type

User fill information for Identifier and Title

Type “jprice“ as Identifier and type “Price” as Title

image-20241007-030506.png

In Formula expression, type:

var attributeId = 211; // Copy from Jira Asset var rawData = $(jname).attributes; let dataJson; try { dataJson = JSON.parse(rawData); } catch (e) { console.error('Error when parsing rawData', e); } const filterResult = dataJson.find(item => item.objectTypeAttributeId.toString() === attributeId.toString()); if (filterResult) { const result = filterResult.objectAttributeValues[0].value; return result; } else { return "Price unavailable"; }

How to copy Attribute ID:

  1. Open Jira Asset

  2. Open your Object schema “Burger Menu”

  3. Open Object TypeDishes”

  4. Click on Attributes tab

  5. Click on Copy button in “Price” row

image-20241007-031558.png

Click Add to save the information

11

In Configuration - Column, click image-20240516-020049.png to create new column

12

In Add Column, choose Integer in Column type

User fill information for Identifier and Title

Type “jamount“ as Identifier and type “Amount” as Title

Select Cell value required to make sure every dish has its amount

image-20241007-032758.png

Click Add to save the information

13

In Configuration - Column, click image-20240516-020049.png to create new column

14

In Add Column, choose Formula in Column type

User fill information for Identifier and Title

Type “jtotal“ as Identifier and type “Total” as Title

image-20241007-033118.png

In Formula Expression, type:

return $(jprice) * $(jamount)

In Summary Label, type “Total:”

In Aggregation operation, select sum to display the amount customer has to pay.

image-20241007-042620.png

Click Add to save the information

15

Click Save to save the grid configuration

image-20241007-033343.png

Exceptional Flow

Users choose the wrong data source/type wrong JSON Path Query “Data Source”

Continued from step #8 in the Basic Flow:

Step

Description

9

An “Errors” message appears 

Use case stops.

Users type wrong the formula

Continued from step #10 in the Basic Flow:

Step

Description

11

An “Errors” message appears 

Use case stops. 

Users click “Cancel” while saving the table 

Continued from step #15 in the Basic Flow:

Step

Description

16

The system will automatically come back to the “Grids” page

Use case stops. 

Use Grid to Order Burger

Order Burger in Customer Portal

  1. Come to Customer Portal, select Common Request

image-20241007-041628.png
  1. Select Order Burger

image-20241007-041812.png
  1. Click on “+” to add row on the grid

image-20241007-042008.png
  1. Double click on Name column to select dishes

image-20241007-042150.png

After select a dish, its price will be shown up

image-20241007-042224.png
  1. Type Amount that you want to order

image-20241007-042257.png

And then the Total is calculate automatically by the formula that is configured in the grid.

  1. Click Send to send the order when you complete selecting dishes.

image-20241007-042911.png

Result on Issue View

  1. Open the request issue

image-20241007-044116.png
  1. Click on Grid button

image-20241007-044633.png

And then the grid Order Burger will be shown on the issue view

image-20241007-044313.png

Conclusion

This use case shows how using Jira Asset for menu management and the Customer Portal for order processing can streamline operations. By turning each order into a Jira issue, businesses like burger shop can better track, manage, and fulfill customer requests.

We hope you can apply this approach to your own processes, enhancing efficiency and control in real-world situations.

 

Related content