# Create Order Request Item Entity for Admin

This section explains how to create the **Order Request Item Entity for Admin** using **App Designer**.\
This entity is designed for administrators who are responsible for **managing order items and adding possible suppliers** for each order request.

The entity structure consists of:

* **Order Item** (1‑1 module)
* **Supplier List** (1‑Many module)

***

### Objective

By completing this section, you will learn how to:

* Create an Admin‑specific entity using App Designer
* Configure master‑detail relationships (Order Item → Supplier)
* Design fields for supplier quotation and availability
* Configure insert, update, and cancel actions
* Define module keys and parent‑child relationships

***

### Step 1: Create Entity

1. From the **AppSpace** screen, click **Form**.
2. A popup dialog opens.
3. Enter a value in **Component Name**.
4. Click **Start Design**.

***

### Step 2: Create Main Tab (Order Request Item)

1. From **Tools > Tabs**, drag **2‑Layer Tab** under the entity name.
2. In the Add Tab dialog:
   * Title: `Order Request Item`
3. Click **Add**.

***

### Step 3: Create Order Item Module (1‑1)

1. From **Tools > Module**, drag **1‑1 Module** under the Order Request Item tab.
2. Click the **pencil icon** to configure the module.

Configure as follows:

* **Module Name**: `Order Item`
* **Table Name**: `wf_order_req_item (T)`

Click **OK**.

1. Click **Configuration Layout**.
2. Select **2 Column** and click **Accept**.

***

### Step 4–12: Configure Order Item Fields

#### Fields in Order Item Module

**Row 1**

* **HARDWAREID**
  * Field type: Dynamic List
  * Table Name: `wf_ms_hardware`
  * Column Show: `HARDWARE_NAME`
  * Column Value: `HARDWARE_ID`
  * viewFlag: Y
* **SPEC**
  * Field type: Textarea
  * viewFlag: Y

**Row 2**

* **UNIT**
  * Field type: Text Box
  * Number Formatter: Integer
  * viewFlag: Y
* **REMARK**
  * Field type: Textarea
  * viewFlag: Y

**Row 3 (Hidden Fields for Linking)**

* **ORDER\_ITEM\_ID**
  * Field type: Hidden
  * Source tag: `id = 'ORDER_ITEM_ID'`
* **REQUEST\_ID**
  * Field type: Hidden
  * Source tag: `id = 'REQUEST_ID'`

***

### Step 13–16: Configure Entity Buttons (Order Item)

Add **Entity Buttons** under the Order Item module with the following settings:

* **SAVE**
  * Page Action: `ENTITY_INSERT`
  * Button Action: `saveEntity()`
* **SAVE**
  * Page Action: `ENTITY_UPDATE`
  * Button Action: `saveEntity()`
* **CANCEL**
  * Page Action: `ENTITY_INSERT`
  * Button Action: `cancelEntity()`
* **CANCEL**
  * Page Action: `ENTITY_UPDATE`
  * Button Action: `cancelEntity()`

***

### Step 17: Create Supplier List Tab

1. From **Tools > Tabs**, drag **Normal Tab** under the table.
2. In the Add Tab dialog:
   * Title: `Supplier List`
   * Columns: 1
3. Click **Add**.

***

### Step 18: Create Supplier Module (1‑Many)

1. From **Tools > Module**, drag **1‑Many Module** under the Supplier List tab.
2. Click the **pencil icon** to configure the module.

Configure as follows:

* **Module Name**: `Supplier`
* **Table Name**: `wf_order_req_item_supplier (T)`

Click **OK**.

***

### Step 19–24: Configure Supplier Fields

#### Hidden Fields

* **ORDER\_ITEM\_SUPPLIER\_ID**
* **ORDER\_ITEM\_ID**

#### Supplier Detail Fields

* **SUPPLIER\_NAME**
  * Field type: Text Box
  * Validate Code: `CHECK_NULL`
  * Search enabled
* **IN\_STOCK**
  * Field type: Text Box
  * Number Formatter: Integer
  * Validate Code: `CHECK_NULL`
* **UNIT\_PRICE**
  * Field type: Text Box
  * Number Formatter: Currency
  * Validate Code: `CHECK_NULL`
* **REMARK**
  * Field type: Textarea

***

### Step 25–30: Configure Module Buttons (Supplier)

Add **Module Buttons** under the Supplier module with the following settings:

* **ADD**
  * Page Action: `SUB_SEARCH`
  * Button Action: `popupActionFlow('[MODULE_ID]')`
* **SAVE**
  * Page Action: `INSERT`
  * Button Action: `actionFormSubmit('insertMany','Y')`
* **SAVE**
  * Page Action: `UPDATE`
  * Button Action: `actionFormSubmit('insertMany','Y')`
* **CANCEL**
  * Page Action: `INSERT`
  * Button Action: `$('#many_[MODULE_ID]_dialog').dialog('close');`
* **CANCEL**
  * Page Action: `UPDATE`
  * Button Action: `$('#many_[MODULE_ID]_dialog').dialog('close');`

***

### Step 31–32: Configure Module Keys

#### Order Item Module Key

* Module Key: `ORDER_ITEM_ID`
* Prefix: `IT`
* Key Length: 18
* Sequence: `ORDER_ITEM_ID_SEQ`

#### Supplier Module Key

* Module Key: `ORDER_ITEM_SUPPLIER_ID`
* Prefix: `SP`
* Key Length: 18
* Sequence: `ORDER_ITEM_SUPPLIER_ID_SEQ`
* Parent Key: `ORDER_ITEM_ID`

***

### Step 33: Save Entity

Click **Save this Entity** to complete the configuration.

The completed entity appears as shown below:

<figure><img src="https://docs.oneweb.tech/oneweb/~gitbook/image?url=https%3A%2F%2F2015371994-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FMpDjHWFRUtZ5nJcSfVXd%252Fuploads%252FmobFEfxdqzFtcrr5CDK7%252Fimage.png%3Falt%3Dmedia%26token%3D7206ec78-8d40-45ea-b0c1-5c7242d6a3f4&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=3f48639f&#x26;sv=2" alt=""><figcaption></figcaption></figure>

***

### Summary

In this section, you have:

* Created the Order Request Item entity for Admin
* Configured Order Item and Supplier modules
* Designed supplier quotation fields
* Added insert, update, and cancel actions
* Defined module keys and parent‑child relationships

This entity enables administrators to manage supplier information and quotations, completing an essential part of the **Order Management App (Web)** workflow.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onewebstack.com/oneweb-platform-th/tutorials-examples/order-management-app-web/app-designer/create-order-request-item-entity-for-admin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
