Skip to content

Commit 2d97cc9

Browse files
authored
Add docs to approval-workflow
1 parent e702487 commit 2d97cc9

File tree

25 files changed

+219
-68
lines changed

25 files changed

+219
-68
lines changed

docs/.vuepress/config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,18 @@ module.exports = {
6666
path: '/approval-workflow/docs/overall/',
6767
children: [
6868
'docs/overall/requirement/',
69+
'docs/overall/install/',
6970
'docs/overall/start/',
70-
'docs/overall/run/',
71+
'docs/overall/status/',
72+
'docs/overall/how-it-works/',
7173
],
7274
},
7375
{
7476
title: 'Develop',
7577
path: '/approval-workflow/docs/develop/',
7678
children: [
7779
'docs/develop/',
80+
'docs/develop/configuration/',
7881
'docs/develop/module/',
7982
],
8083
},
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
# Develop
1+
# Develop
2+
This is the documentation for developers to develop or edit my script. There will be sections below to choose from, range from editing the configurations to changing the workflow.
3+
4+
## Configuring
5+
- [Configuring CONFIG file]()
6+
7+
8+
## Create-your-own approval workflow
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Configuration File
2+
This object contains the settings to compute up the script.
3+
4+
::: tip PREVIEW
5+
Preview code at [https://github.com/sagelga/approval-workflow/blob/master/src/Config.js](https://github.com/sagelga/approval-workflow/blob/master/src/Config.js)
6+
:::
7+
8+
### CONFIG.`headerRow`
9+
10+
`Number`
11+
12+
How many rows that works as `header` row. Last row (if defined more than one) will be used as sheet "attribute".
13+
14+
Unit: row(s)
15+
16+
Default: 1
17+
18+
### CONFIG.`responseTimeout`
19+
20+
`Number`
21+
22+
How many days since request has been sent, until counted as 'Timeout'.
23+
24+
Unit of time: day(s)
25+
26+
Default : 14
27+
28+
### CONFIG.`flow_step`
29+
30+
`Number`
31+
32+
How many steps of approval that you need.
33+
34+
::: danger DANGER
35+
Script currently supports 2 steps of approval.</br>
36+
Dynamic steps is not being developed yet.
37+
:::
38+
39+
Unit: step(s)
40+
41+
Default: 2
42+
43+
### CONFIG.`header_sheet`
44+
45+
`String`, `case sensitive`
46+
47+
What is the header sheet name.
48+
49+
### CONFIG.`inbound_sheet`
50+
51+
`String`
52+
53+
What is the inbound sheet name
54+
55+
Inbound = Receiving approval result
56+
57+
### CONFIG.`form_column_range`
58+
59+
`String`
60+
61+
In the key `form_column_range`, there is a `start` and `stop` key.
62+
63+
In the `start` key, type in string that is a column character (starts with A) that is the first column that is a information range.
64+
65+
Similar to `stop` key, type in string that is the last column of the information range.
66+
67+
A column that is in between (includes the `start` and `stop` ) is included* in the response summary table.
68+
69+
### CONFIG.`approval_form_url`
70+
71+
`String`, `case sensitive`
72+
73+
URL to the form (**with a Response ID Parameter**)
74+
75+
### CONFIG.`admin_email_address`
76+
77+
`String`
78+
79+
Email address that will receives a failure notification
80+
81+
### CONFIG.`email`
82+
83+
Contains information about the prefix of the email (as noted as `CONFIG.email.step0.subject.request.prefix`)
84+
85+
In the diagram described below, one node represents a dot notation. A leaf node represents value (`String`).
86+
87+
![](./src/emailObject.png)
Loading

docs/approval-workflow/docs/develop/module/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Order of module
1+
# Function Module
22
Each function will be separated by its functionality or part of work. Each function is mostly independent from each other, but might requires data (such as Object) to complete any transaction.
33

44
::: tip NOTE
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Email Function Module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Email Module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Functions Module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Inbound Sheet Module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Main Module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Sheets Module
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Utility Module
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Overall
22
- [Requirement](./requirement)
33
- [Start](./start)
4-
- [Run](./run)
4+
- [Install](./install)
5+
- [Status](./status)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# How it works
2+
*Tag : how-it-works*
3+
4+
This page will show you how the approval workflow works in real time. We still recommends you to read the code in `approvalProcess()` function.
5+
6+
## How the script works
7+
1. Script will runs from Row n+1 (n = number of header row)
8+
2. Checks the `Step 1 Approver Status` of the current row
9+
1. If it is `blank`, it will identifies as `New Request` and start the `New Request` process. Then repeats (2) with next row.
10+
2. If it is `Waiting`, it will checks the `Inbound` sheet data that holds the same Request ID and updates the corresponding status when there is a response. Then repeats (2) with next row.
11+
3. If the Status is `Approved`, the process repeats (2). But with `Step 2 Approver Status` and `Request Step 2 Approval`.
12+
4. Otherwise (as in case of `Reject` or `Skipped`), script will repeats (2) with next row.
13+
3. When the status has reached to the last approver, (2) will starts again. But this time for `Approved`, it will sends an email to responder to do what the approver wants to do. Then the status will be updated as `Finished`.
14+
15+
### New Request
16+
Script will do as following to requests that has been tagged as `New Request`.
17+
1. Send email to requester to notifies that the request is being processed.
18+
2. Send email to `Step 1 Approver`, as determined by the requester.
19+
20+
### Checking the inbounds
21+
Script will do as following to request that has been tagged as `Check for inbounds`.
22+
1. Retrives the `Reqest ID` from the request.
23+
2. Match `Request ID` with `Request ID` in inbounds. First response (order by Time) that contains the same `Request ID` will be chosen.
24+
3. Chosen Response status are applied to the request.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Install the script
2+
*Tags: Github, Repository*
3+
4+
Before you can start using the script, here's something you need to install and manually setup.
5+
6+
First thing you need to do is to install the script. The script will allows you to run the flow.</br>
7+
To use the script, you must have acesss to items that is defined on [System Requirement](./requirement) and do the following step(s) to complete the installation.
8+
9+
1. Visit [https://github.com/sagelga/approval-workflow](https://github.com/sagelga/approval-workflow)
10+
</br>![](./src/repo1.png)
11+
2. Select "Clone" (noticeable by the bright green button)
12+
</br>![](./src/repo2.png)
13+
3. Select "Download ZIP"
14+
</br>![](./src/repo3.png)
15+
4. After extrating the `.zip` file, there will be multiple `.js` file in `src/`.
16+
</br>![](./src/repo4.png)
17+
5. Go to your Target sheet (optional)
18+
6. In Tool Bar, select Tools > Script editor
19+
</br>![](./src/sheets2.png)
20+
7. You will be directed to Target sheet's script editor.
21+
</br>![](./src/appscript1.png)
22+
8. For each file, do as following
23+
1. Open the file using any Text Editor application (i.e. Visual Studio Code)
24+
2. Copy all of its content
25+
3. Paste it to the Target Google Apps Script script page.
26+
4. (Optional) Create a new script file by clicking a <img src="./src/outline_add_black_24dp.png" style="height:1em">
27+
5. Repeat the process until you copied all of the files.
28+
9. Done.

docs/approval-workflow/docs/overall/run/README.md

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,7 @@
1-
# Before you start
2-
Before you can start using the script, here's something you need to install and manually setup.
3-
4-
## Install the script
5-
*Tags: Github, Repository*
6-
7-
First thing you need to do is to install the script. The script will allows you to run the flow.</br>
8-
To use the script, you must have acesss to items that is defined on [System Requirement](./requirement) and do the following step(s) to complete the installation.
9-
10-
1. Visit [https://github.com/sagelga/approval-workflow](https://github.com/sagelga/approval-workflow)
11-
</br>![](./src/repo1.png)
12-
2. Select "Clone" (noticeable by the bright green button)
13-
</br>![](./src/repo2.png)
14-
3. Select "Download ZIP"
15-
</br>![](./src/repo3.png)
16-
4. After extrating the `.zip` file, there will be multiple `.js` file in `src/`.
17-
</br>![](./src/repo4.png)
18-
5. Go to your Target sheet (optional)
19-
6. In Tool Bar, select Tools > Script editor
20-
</br>![](./src/sheets2.png)
21-
7. You will be directed to Target sheet's script editor.
22-
</br>![](./src/appscript1.png)
23-
8. For each file, do as following
24-
1. Open the file using any Text Editor application (i.e. Visual Studio Code)
25-
2. Copy all of its content
26-
3. Paste it to the Target Google Apps Script script page.
27-
4. (Optional) Create a new script file by clicking a <img src="./src/outline_add_black_24dp.png" style="height:1em">
28-
5. Repeat the process until you copied all of the files.
29-
9. Done.
30-
31-
## Start the script
1+
# Start the script
322
Here's some options you can run the script
333

34-
When you start the script, Google will ask your permission to
35-
- Send emails as you
36-
- See, edit, create, delete your spreadsheets in Google Drive
37-
38-
If you decline to give us the permission, this script will be unable to send email to approver or run. Prompt will ask for your permission again if it fails to acquire your permission.
39-
40-
::: warning
41-
After you authorized your account to the script, the script will run on your behalf.
424

43-
If you like to use other account to send the emails and running the workflow, please authorize this step with that account.
44-
:::
455

466
### Option 1 Manually via UI
477
1. Open the `sheet`
@@ -66,8 +26,20 @@ Running the script manually is too hard work for you. We recommended you to set
6626
- Time-based (e.g. Hourly, Daily)
6727
- Event-based (e.g. After new Form sent)
6828
- and for other parameter, you can leave it as is.
29+
::: tip
30+
We recommend you to read Google Documentations on what each options differs on
31+
:::
6932
4. After you done configuring, press "Save"
7033

71-
::: tip
72-
We recommend you to read Google Documentations on what each options differs on
34+
## Permission Request
35+
When you start the script, Google will request your permission to
36+
- Send emails as you
37+
- See, edit, create, delete your spreadsheets in Google Drive
38+
39+
If you decline to give us the permission, this script will be unable to send email to approver or run. Prompt will ask for your permission again if it fails to acquire your permission.
40+
41+
::: warning
42+
After you authorized your account to the script, the script will run on your behalf.
43+
44+
If you like to use other account to send the emails and running the workflow, please authorize this step with that account.
7345
:::
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Approval Status
2+
*Tags : Status*
3+
4+
## Script's Status
5+
For each of the approval request, it will only contains one of the four status listed below
6+
7+
1. **Approved**</br>
8+
Approver of that level has approved the request. The request will either
9+
1. Send to the team that are response of doing what the approver wants to
10+
2. Elevate the request to another approver. This will restart the process, but with a `Step [current_step + 1]` approver.
11+
2. **Rejected**</br>
12+
Any approver on any level rejects the request. Requester will be notified as the request has been rejected.
13+
3. **Waiting**</br>
14+
Request still waiting for approver's approval. Waiting request will either
15+
1. Continue to wait
16+
2. Resend the request via an email again after xx days of no response
17+
4. **Skipped** or **[anything else]**</br>
18+
Request is skipped by either
19+
1. Sheet Manager forced to skip this approval request.
20+
2. Script forces the request to skip this request flow (i.e. Request has been Completed and Fulfilled).
21+
2. Script ran to an issue, as it cannot understand the status of that request.
22+
5. **Finished**</br>
23+
Request has been approved. E-mail has been sent to responders and everything works perfectly. Script will acts this response in the same way as 'Skipped'.
24+
25+
Script will runs and actively refreshing the status only to status that are either 'Waiting' or 'Approved'. 'Rejected' and 'Skipped' request will be skipped immedietely.
26+
27+
## Edit the status
28+
Editing the status is possible, but please make sure that the status format matches [System's Status](#script-s-status) by different method defined below:
29+
30+
### Option 1 Edit status manually
31+
Works with all status type
32+
1. Go to the response row that you want to override
33+
2. Go to the 'current step' of approval (marked with 'Waiting') or any step that will not get skipped. For more information about response status, please visit the link below.
34+
3. Edit the status of that cell to any valid status value
35+
4. Starts or wait for script to run
36+
Make sure that you are typing in the correct format of approval status. If the status is incorrect, it will fallback and tries to roll back to the previous status.
37+
38+
### Option 2 Faking up Response
39+
Loophole behind this allows you to Approve or Reject any Response. Only works when the status is in `Waiting`.
40+
1. Copy the Request ID from the request that you want to edit
41+
2. Go to Target Response Form
42+
3. Send a form with the Request ID and a status that you want
43+
4. Script will picks the Respose as valid and continues with the script.

0 commit comments

Comments
 (0)