# Create Leave Request Entity

This section explains how to create the **Leave Request Entity** using **App Designer**.\
This entity is used by requesters to submit and manage leave requests.

***

### Step 1: Create New Entity

1. From the **App Space** screen, click **Form**
2. Enter a value in **Component Name**
3. Click **Start Design**

***

### Step 2: Configure Entity Properties

1. Click the **Pencil icon** to open **Entity Configuration**

<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%252FzyaNR9XqRlilezSk6Ow8%252Fimage.png%3Falt%3Dmedia%26token%3D383930a0-11b3-47e8-a992-c6d5a5ede10d&#x26;width=768&#x26;dpr=3&#x26;quality=100&#x26;sign=d08ac4e6&#x26;sv=2" alt=""><figcaption></figcaption></figure>

2. Set **Tab Condition** to `Y`

<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%252FTbgmQy3TwqpOGYkCALK5%252Fimage.png%3Falt%3Dmedia%26token%3Df86b45b2-59bc-4d21-ae72-4fda6b6341b8&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=cbbc1ca8&#x26;sv=2" alt=""><figcaption></figcaption></figure>

3. Click **OK**

***

### Step 3: Create Main Tab – Leave Request

1. From **Tools > Tabs**, drag **2‑Layer Tab**
2. Set **Title** to `Leave Request`
3. Click **Add**

<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%252Fe6cQ42mI9jNiRUJP9UCj%252Fimage.png%3Falt%3Dmedia%26token%3D8186a50c-3ff5-41e7-9fe7-f881ed11991a&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=4f02f77f&#x26;sv=2" alt=""><figcaption></figcaption></figure>

***

### Step 4: Create Leave Request Module (1‑1)

1. From **Tools > Module**, drag **1‑1 Module**

<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%252FPEhrwb6R4PyPTi9z0Tjb%252Fimage.png%3Falt%3Dmedia%26token%3D3975f7d1-c922-4fa0-a728-7866aecdc66b&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=dbff6da7&#x26;sv=2" alt=""><figcaption></figcaption></figure>

2. Click **Pencil icon** to configure module

<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%252FgxRVBvojgd8vlvVmCqa2%252Fimage.png%3Falt%3Dmedia%26token%3D860bb9e7-3dba-45fb-964a-8baa6df53155&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=9904e9c2&#x26;sv=2" alt=""><figcaption></figcaption></figure>

3. Configure:

* **Module Name**: `Leave Request`
* **Table Name**: `wf_service_request (T)`

<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%252FaAlxWTNBwgEDA82K0TfT%252Fimage.png%3Falt%3Dmedia%26token%3De8ec7315-9c11-46c5-9c68-e693ef86e6d5&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=e0cbb515&#x26;sv=2" alt=""><figcaption></figcaption></figure>

4. Set **SQL Work Queue**

```
select wf_service_request.request_id,
       wf_service_request.requester,
       wf_service_request.sub_request_type
from wf_service_request
where wf_service_request.request_type = '04'
```

<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%252FwPmarDJWSDJiL7Y2aADa%252Fimage.png%3Falt%3Dmedia%26token%3D0142a2da-6167-425b-a18a-2e71120cdd90&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=73cb631a&#x26;sv=2" alt=""><figcaption></figcaption></figure>

5. Click **OK**

***

### Step 5: Configure Layout

1. Click **Configuration Layout**
2. Select **2 Column**
3. Click **Accept**

<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%252FBZ1ERSe17QWXFNXKkFyL%252Fimage.png%3Falt%3Dmedia%26token%3D8ebb30c2-d94c-4e5f-9cdd-2fedc7a79380&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=4769d775&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<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%252FKjhaLRUgMhrd14EVw5jD%252Fimage.png%3Falt%3Dmedia%26token%3Db20a3cbd-17b7-4043-8bb4-3d1365642701&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=b015e14c&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<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%252FdCRRlDQU8HSJW9YHcnjr%252Fimage.png%3Falt%3Dmedia%26token%3Deb012746-9d54-433d-9e8e-30f6f5710ddd&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=97a87e46&#x26;sv=2" alt=""><figcaption></figcaption></figure>

***

### Step 6: Configure REQUEST\_ID Field

1. Drag **Text Box** to first cell

<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%252FIHOQRq1WNDjqpnWC193r%252Fimage.png%3Falt%3Dmedia%26token%3Ddabfe3f9-8360-4885-8aa5-42b82e80c693&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=a20ed429&#x26;sv=2" alt=""><figcaption></figcaption></figure>

2. Click **Pencil icon**

<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%252FFxTMK0OwlmnAnB1WeNsw%252Fimage.png%3Falt%3Dmedia%26token%3D1ea812e9-edcf-498b-b9b2-1be95da5f3cf&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=54702353&#x26;sv=2" alt=""><figcaption></figcaption></figure>

3. Configure:

* Source: `readonly`
* FIELD\_ID: `REQUEST_ID`
* Populate ShowFieldName → `Request Id`

<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%252FmkjYqNjEhthWWk0bKCkI%252Fimage.png%3Falt%3Dmedia%26token%3D5546db6a-01a9-4455-9fff-4656ad95389b&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=4b20c9eb&#x26;sv=2" alt=""><figcaption></figcaption></figure>

4. Enable Search & alignment

<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%252FPmvytkLmTzXKb0PQdKvR%252Fimage.png%3Falt%3Dmedia%26token%3Dac1e745c-9dac-4b33-9a63-df359597e539&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=fc546708&#x26;sv=2" alt=""><figcaption></figcaption></figure>

<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%252FGxRlyB0oRq2s2weF6OaO%252Fimage.png%3Falt%3Dmedia%26token%3D7fc00de2-6223-463a-870b-e1510ab7325f&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=290c0a11&#x26;sv=2" alt=""><figcaption></figcaption></figure>

***

### Step 7: Configure REQUESTER Field

1. Drag **Text Box** to table

<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%252Fbb5LTfP7uwcQaocEV7lg%252Fimage.png%3Falt%3Dmedia%26token%3Dcc25fc3c-1e45-4a5b-9ed3-157cf8f4089d&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=8b8c173&#x26;sv=2" alt=""><figcaption></figcaption></figure>

2. Configure FIELD\_ID = `REQUEST`

<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%252FQmodY1IziFlzIArveLrF%252Fimage.png%3Falt%3Dmedia%26token%3De3dec642-9140-4e57-9214-880ace41645f&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=22a812ce&#x26;sv=2" alt=""><figcaption></figcaption></figure>

***

### Step 8: Append New Row

Click **Append Row**

<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%252FXZTDki4t5ZmB4EUeDLKP%252Fimage.png%3Falt%3Dmedia%26token%3D60a6cea2-c64e-4a6d-ae95-8668234c060c&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=91f3626&#x26;sv=2" alt=""><figcaption></figcaption></figure>

***

### Step 9: Add Leave Type (Dynamic List)

1. From **Tools > Field**, drag **Dynamic List** to the first cell of the new row
2. Configure:
   * Table Name: `wf_ms_sub_request_type`
   * Column Show: `SUB_REQ_NAME`
   * Column Value: `SUB_REQ_TYPE_ID`
   * Condition Value: `request_type='04'`
   * FIELD\_ID: `SUB_REQUEST_TYPE`
   * ShowFieldName: `Leave Type`
   * Enable Search / Alignment Left
3. Click **OK**

***

### Step 10: Add Project Field

1. Drag **Dynamic List** to the second cell
2. Configure:
   * Table Name: `wf_ms_project`
   * Column Show: `PROJECT_NAME`
   * Column Value: `PROJECT_ID`
   * FIELD\_ID: `PROJECT`
3. Click **OK**

***

### Step 11–12: Contact Info & Request Type

#### Contact / Tel

* Field Type: **Text Area**
* FIELD\_ID: `CONTACT_INFO`
* ShowFieldName: `Contact/Tel.`

#### Request Type

* Field Type: **Hidden**
* FIELD\_ID: `REQUEST_TYPE`
* Default Value: `04`

***

### Step 13–24: Decision Fields (Supervisor → Authorize)

For each decision level, add fields in order:

#### Dynamic List

* Table: `wf_ms_list_box`
* Column Show: `DISPLAY_NAME`
* Column Value: `DISPLAY_CODE`
* Condition Value:
  * Supervisor: `CATEGORY_CODE='SUP_PM_DECISION'`
  * Head: `CATEGORY_CODE='HEAD_DECISION'`
  * HR: `CATEGORY_CODE='HR_DECISION'`
  * Authorize: `CATEGORY_CODE='AUTHORIZE_DECISION'`
* FIELD\_ID:
  * `DECISION_SUP_PM`
  * `DECISION_HEAD`
  * `DECISION_HR`
  * `DECISION_AUTH`

#### Remark (Text Box)

* FIELD\_ID:
  * `DECISION_SUP_PM_REMARK`
  * `DECISION_HEAD_REMARK`
  * `DECISION_HR_REMARK`
  * `DECISION_AUTH_REMARK`

***

### Step 25: Configure Leave Request Module Key

1. Open **Leave Request Module Configuration**
2. Add Module Key:
   * Module Key: `REQUEST_ID`
   * KeyLen: `10`
   * Sequence: `REQUEST_ID_SEQ`
3. Click **OK**

***

### Step 26: Create “Normal Leave” Tab

1. From **Tools > Tabs**, drag **Normal Tab**
2. Title: `Normal Leave`
3. Columns: `1`
4. Click **Add**

***

### Step 27: Create Normal Leave Module (1‑Many)

* Module Name: `Normal Leave`
* Table Name: `wf_leave_req_item (T)`

***

### Step 28–33: Normal Leave Fields

#### Hidden Fields

* `LEAVE_ITEM_ID`
* `REQUEST_ID`

#### Leave Item Fields

* **Leave Type** (List Box)
  * Values: Errand / Sick / Vacation / Other
* **Specify** (Text Box)
* **Start Date** (Calendar)
* **End Date** (Calendar)

***

### Step 34–39: Normal Leave Module Buttons

Add Module Buttons:

| Button | Page Action | Button Action                                      |
| ------ | ----------- | -------------------------------------------------- |
| Add    | SUB\_SEARCH | popupActionFlow('\[MODULE\_ID]')                   |
| Delete | SUB\_SEARCH | \[MODULE\_ID]Delete()                              |
| Save   | INSERT      | actionFormSubmit('insertMany','Y')                 |
| Save   | UPDATE      | actionFormSubmit('insertMany','Y')                 |
| Cancel | INSERT      | $('#many\_\[MODULE\_ID]\_dialog').dialog('close'); |
| Cancel | UPDATE      | $('#many\_\[MODULE\_ID]\_dialog').dialog('close'); |

***

### Step 40: Normal Leave Module Keys

* Parent Key: `REQUEST_ID`
* Item Key:
  * `LEAVE_ITEM_ID`
  * Sequence: `LEAVE_ITEM_ID_SEQ`

***

### Step 41–54: Replacement Leave Tab & Module

#### Tab

* Title: `Replacement Leave`

#### Module

* Module Name: `Replacement Leave`
* Table: `wf_leave_req_item (T)`

#### Fields

* Hidden: `LEAVE_ITEM_ID`, `REQUEST_ID`
* Calendar: `WORK_DATE`
* Text Box: `RW_NO`
* Calendar: `START_DATE` (Leave Date)

#### Module Buttons

(Same pattern as Normal Leave)

#### Module Keys

* Item Key: `LEAVE_ITEM_ID`
* Parent Key: `REQUEST_ID`

***

### Step 55–61: Entity Buttons (Leave Request)

Add **Entity Buttons** under Leave Request tab:

| Button | Page Action    | Button Action  |
| ------ | -------------- | -------------- |
| Add    | ENTITY\_SEARCH | addEntity()    |
| Delete | ENTITY\_UPDATE | deleteEntity() |
| Cancel | ENTITY\_INSERT | cancelEntity() |
| Cancel | ENTITY\_UPDATE | cancelEntity() |
| Save   | ENTITY\_INSERT | saveEntity()   |
| Save   | ENTITY\_UPDATE | saveEntity()   |
| Search | ENTITY\_SEARCH | searchResult() |

***

### Final Result (Overview)

The completed Leave Request Entity screen will look like the following:

<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%252F0BKdhUwr9q5dirgHAXeO%252Fimage.png%3Falt%3Dmedia%26token%3De03940ac-e479-4c64-8558-3a7fb2422faa&#x26;width=768&#x26;dpr=1&#x26;quality=100&#x26;sign=1252148b&#x26;sv=2" alt=""><figcaption></figcaption></figure>

***

### Summary

In this section, you have:

* Created the Leave Request entity
* Configured module, layout, and fields
* Enabled search and read‑only behavior
* Prepared the entity for Normal Leave and Replacement Leave tabs


---

# 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/leave-control-app/app-designer/create-leave-request-entity.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.
