/
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, we will use REST as our external database system.

image-20241008-053739.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

    1. Click on “Asset” on Navigation bar

    2. Click on “Object Schemas”

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

    1. Click on “Create Object Schema”

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

    3. Fill all required information

    4. Click on “Create”

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

    1. Click on “Create Object Type”

    2. Fill all required information

    3. Click “Create”

image-20240918-094441.png
image-20241007-105803.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-110046.png
  1. Create objects

    1. Click on “Create Object”

    2. Fill all required information

    3. Click on “Create”

image-20240918-094639.png
image-20241007-110126.png

Finally, we have a menu like below.

image-20241007-111456.png

Configure Data Source “Burger Menu”

Actions

Actions

1

Click Add Data Source in Data Source

image-20240918-100236.png
2

Enter name “Burger Menu”

image-20240918-100333.png
3

a. Datasource Type:
Select Datasource Type = REST

b. URL: fill your REST API

c. Authorization:

  • Select “BASIC”

  • Username: your Jira username

  • Password: your password used to login

d. Key = “Accept”

e. Value = “*/*”

f. Method = POST

image-20240918-110743.png
4

Body:

{ "objectTypeId": 16, "objectSchemaId": 2, "resultsPerPage": 9999, "includeAttributes": true }

objectTypeId is ID of the Object Type that you want to find

objectSchemaId is ID of the Object Schema that you want to find

How to take objectTypeId and objectSchemaId: Open your Object Type and view the URL:

“ObjectSchema.jspa?id=2” → ID of Object Schema “Burger Menu” = 2

”typeId=16” → ID of Object Type “Dishes” = 16

image-20241007-111023.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-084020.png
  1. Fill in field Request name = “Order Burger”

image-20241007-084214.png
  1. Click Create request type in Request types

Configure Grid “Order Burger”

Basic Flow

Actions

Actions

1

Create Add Grid

2

Fill information for Name = “Order Burger”

3

In Configuration - Column, click Add new column to create new column

4

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-094125.png

Click Add to save the information

5

In Configuration - Column, click Add new column to create new column

6

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-094339.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:

$.objectEntries[*]
image-20241007-103626.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

7

In Configuration - Column, click Add new column to create new column

8

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-094307.png

In Formula expression, type:

var attributeId = 181; // Take 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. View Id of Price

image-20241007-094707.png

Click Add to save the information

9

In Configuration - Column, click Add new column to create new column

10

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

11

In Configuration - Column, click Add new column to create new column

12

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

13

Click Save to save the grid configuration

image-20241007-100033.png

Exceptional Flow

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

Continued from step #6 in the Basic Flow:

Step

Description

7

An “Errors” message appears 

Use case stops.

Users type wrong the formula

Continued from step #8 in the Basic Flow:

Step

Description

9

An “Errors” message appears 

Use case stops. 

Users click “Cancel” while saving the table 

Continued from step #13 in the Basic Flow:

Step

Description

14

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 Order Burger

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

image-20241007-105027.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 Create to send the order when you complete selecting dishes.

image-20241008-052639.png

Result on Issue View

image-20241008-053739.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.