Direct Access URL for Screens of Approval, Confirmation, Reference, etc


# Direct access URL for workflow screens

## Preface

Thanks for @doriburu 's precedence work about direct access URL of workflow. 
https://qiita.com/doriburu/items/ad889da4a4c9805cb47c

I owed so much information on his/her document.


## Goal
This article will tell you how to access to the specific Intra-mart workflow screens such as apply, approval, references and so on.

## Target Reader
Administrator, Developer

## Contents

#### Prerequisites

* Intra-mart is already set up and running
* IM-Workflow and IM-FormaDesigner is ready.
* Understanding of basic structure and parameters of IM-Workflow(Flow ID, System Matter ID, Node ID and so on)

#### 1.Show an approval screen directly from specific URL

> http(s)://{hostname}/{war name}/im_workflow/common/switch/switch_content?imwSystemMatterId={System Matter ID}&imwUserDataId={User Data ID}&imwNodeId={Node ID}&imwPageType=4

'System Matter ID'(System Job ID), 'User Data ID', and 'Node ID' depend on the flow you want to show.
The param imwPage is always '4' whenever you want show approval screen.

To find these parameters quickly, you can use the following SQL.

``` sql
select * from imw_t_actv_matter inner join imw_t_actv_task on imw_t_actv_matter.system_matter_id = imw_t_actv_task.system_matter_id where imw_t_actv_matter.system_matter_id = 'ma_xxxxxxxxxx'
```


#### 2.Show a detail screen directly from specific URL


> http(s)://{hostname}/{war name}/im_workflow/common/switch/switch_content_detail?imwSystemMatterId={System Matter ID}&imwUserDataId={User Data ID}&imwPageType=6

'System Matter ID'(System Job ID), and 'User Data ID' depend on the flow you want to show.
The param imwPage is always '6' whenever you want show a detail screen.

To find these parameters quickly, you can use the following SQL.

``` sql
select * from imw_t_actv_matter where imw_t_actv_matter.system_matter_id = 'ma_xxxxxxxxxx'
```

#### 3.The mechanism of direct access using "switch content"

You may have used "im_workflow/common/switch/switch_content" and "im_workflow/common/switch/switch_content_detail" to access some specific workflow screens.
This switch content mechanism redirects workflow screens from arguments passed through URL.

The following is the difference of URL

##### "im_workflow/common/switch/switch_content"

You can access to the apply, approval, and confirmation screen via this URL.
You can NOT use this URL for detail, and reference screens.

The following table is available parameters for this URL.


The request parameter specification and details for both URL as follows.

* Apply/Approve/Confirm means required parameters for each status.
* Temporary save, re-apply, and draft apply are targets but I do not explain here because I rarely use these screen types.

| Parameter Key | Input Value | Apply | Approve | Confirm | Remarks |
|:--------------|:------------|:-----:|:-------:|:-------:|:--------|
| imwFlowId     |Flow ID      |  ✓  |         |         |         |
| imwApplyBaseDate | Apply Base Date(Format:yyyy/mm/dd) |✓||||
| imwPageType | Screen Type Enumerable Flag | ✓ | ✓ | ✓ | range [0 - 5] |
| imwUserDataId | User Data ID ||✓|✓||
| imwSystemMatterId| System Matter ID ||✓|✓||
| imwNodeId | Node ID ||✓|✓| Fill in ID of waiting node|
| imwAuthUserCode |Authorized User Code||||Original User of the process|
| imwCallOriginalPagePath | Transition Page Path |||| Transition page path after process| 
| imwCallOriginalParams | Transition Page Parameters||||Parameters for transition page path|
| imwSerialProcParams | Parameters for serial process ||||Ignorable in most cases|
| imwArriveType | Arrival Type ||||Ignorable in most cases|


##### "im_workflow/common/switch/switch_content_detail"

You can access to the process detail, reference, and confirmation detail screen via this URL.
You can NOT use this URL for approval process, and confirm process screens..

| Parameter Key | Input Value | Detail | Reference | Confirm Detail | Remarks |
|:--------------|:------------|:-----:|:-------:|:-------:|:--------|
| imwPageType | Screen Type Enumerable Flag | ✓ | ✓ | ✓ | Range [6 - 9]|
| imwUserDataId | User Data ID| ✓ | ✓ | ✓ ||
| imwSystemMatterId| System Matter ID | ✓ | ✓ | ✓ ||


The official document about the URLs:
[Transition URL to the detailed picture of IM-Workflow](https://www.intra-mart.jp/document/library/iap/public/im_workflow/im_workflow_viewcreator_guide/texts/appendix/link_wf_detail_page.html)


#### 4. Enumerable flags for screen type 

| Title | Enum Key | Value |
|:--|:--|:-:|
| Apply Screen |pageTyp_App|0|
| Temporary Save Screen |pageTyp_TempSave|1|
| Draft Apply Screen |pageTyp_UnApp|2|
| Re-apply Screen |pageTyp_ReApp|3|
| Process(Approve) Screen|pageTyp_Proc|4|
| Confirm Process Screen |pageTyp_Cnfm|5|
| Process Detail Screen |pageTyp_Procdetail|6|
| Reference Detail Screen |pageTyp_Refdetail|7|
| Confirm Detail Screen |pageTyp_Cnfmdetail|8|
| Archived Detail Screen |pageTyp_ArcMatdetail|9|

The official documents:
[IM-Workflow CodeList](https://www.intra-mart.jp/apidoc/iap/apilist-ssjs/doc/im_workflow/com/imwCodeList.html)