context.QueryStrings
Overview¶
Get the value of a query parameter in a URL string using a "Server Script".
Methods¶
| No | Name | Description |
|---|---|---|
| 1 | Data | Get the parameter value as a string type |
| 2 | Bool | Get the parameter value as a boolean type |
| 3 | Int | Get the parameter value as an integer type |
Usage Examples¶
In the following example, the value of the parameters (name, id) included in the URL string when accessed via http://example.com/items/1000/index?name=Hayato&id=123 is obtained.
JavaScript¶
let name = context.QueryStrings.Data('name');
context.Log(name); // Hayato
let id = context.QueryStrings.Int('id');
context.Log(id); // 123
Code Samples¶
1. Filter by an arbitrary status when the index is accessed from outside
When the index screen is opened with a URL like the following, the screen is displayed filtered by the status Completed (900).
For example, when linking from an external system with a URL, adding the parameter when generating the link string lets you open the index screen in a filtered state.
JavaScript¶
Condition: When view processing
2. Get the record ID of the copy source when making a reference copy
When making a reference copy, get the record ID of the copy source and set it in an arbitrary column.
When making a reference copy, the new record screen is opened with a URL like the following.
This CopyFrom is the record ID of the copy source, so get it with QueryStrings.
JavaScript¶
Condition: Before opening the page
Supported Versions¶
- Pleasanter 1.3.15.0 or later
- Pleasanter .NET Framework version 0.51.15.0 or later