Order Burger using POST method function to call to Jira Asset API
In this use case you will learn how to build an order management system of a burger shop using Table Grid Next Generation app.
You will also learn how to use external data source in TGNG app and how to use external data in a select list in a grid column configuration:
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.
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
Open Jira Asset by clicking on “Asset” on Navigation bar
Create schema named “Burger Menu”
Click on “Create schema”
You can choose from a template or create a blank schema
Fill all required information
Click on “Create”
Create object type named “Dishes”
Click on “Add object type”
Fill all required information
Click “Create”
Create attributes “Price”
Open tab “Attributes”
Type attribute name “Price”
Select Type = Default and Type Value = Float
Click “Add” to add attribute
Create objects
Click on “Create object”
Fill all required information
Click on “Create”
Finally, we have a menu like below.
Configure Data Source “Burger Menu”
Actions | |
---|---|
1 | Click Add Data Source in Data Source |
2 | Enter name “Burger Menu” |
3 | a. Datasource Type: b. URL: fill your REST API How to have REST API URL: Assets REST API guide c. Authorization:
How to manage your API Token: Manage API tokens for your Atlassian account | Atlassian Support d. Key = “Accept” e. Value = “*/*” f. Method = POST |
4 | Body to query: {
"qlQuery": "objectType = Dishes"
} |
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”
Open your Project, click on Project settings
Click Request types
Click Create request type
Fill in all required field and click Add
Configure Grid “Order Burger”
Basic Flow
Actions | |
---|---|
1 | Click Add Grid |
2 | Select Grid fields (to populate data manually) Click Confirm |
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 |
5 | In Configuration - Column, click |
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 Click Add to save the information |
7 | In Configuration - Column, click |
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 In Option attributes, click + and type “attributes” In Dynamic options, choose “Burger Menu” for Data Source Type the JSON Path query: $.values[*] Click Get data In Mapping:
Click to save the Dynamic options Click Add to save the information |
9 | In Configuration - Column, click |
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 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:
Click Add to save the information |
11 | In Configuration - Column, click |
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 Click Add to save the information |
13 | In Configuration - Column, click |
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 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. Click Add to save the information |
15 | Click Save to save the grid configuration |
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
Come to Customer Portal, select Common Request
Select Order Burger
Click on “+” to add row on the grid
Double click on Name column to select dishes
After select a dish, its price will be shown up
Type Amount that you want to order
And then the Total is calculate automatically by the formula that is configured in the grid.
Click Send to send the order when you complete selecting dishes.
Result on Issue View
Open the request issue
Click on Grid button
And then the grid Order Burger will be shown on the issue view
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.