Skip to content

Extended Server Scripts

Overview

Define "Server Script" that can be used throughout the system.

Limitations

  1. After updating the JSON file or script file of the extended script, the changes will not be reflected until you "restart the application".

How To Set Up An Extended Script

Create a json file containing the following content under .¥Pleasanter¥App_Data¥Parameters¥ExtendedServerScripts¥ and "restart the application". The file extension must be json. Folders can be hierarchically organized under ExtendedServerScripts. In this case, all json files under the folder will be loaded as configuration files.

Parameter name e.g. Description
Name Sample Set the name when executing from the API.
Description "This script executes..." Description of the script. Does not affect operation.
Disabled false If true, it will be disabled and will not operate.
DeptIdList [1,2,3] Specify the target dept ID in array format. If not specified, this can be omitted.
GroupIdList [1,2,3] Specify the target group ID in array format. If not specified, this can be omitted.
UserIdList [1,2,3] Specify the target user ID in array format. If not specified, this can be omitted.
SiteIdList [1,2,3] Specify the target site ID in array format. If not specified, this can be omitted.
IdList [1,2,3] Specify the target record ID in array format. If not specified, this can be omitted.
WhenloadingSiteSettings false If true, execute when loading site settings.
WhenViewProcessing false If true, execute when processing views.
WhenloadingRecord false If true, execute when loading records.
BeforeFormula false If true, execute before the formula.
AfterFormula false If true, execute after the formula.
BeforeCreate false If true, execute before creating.
AfterCreate false If true, execute after creating.
BeforeUpdate false If true, execute before updating.
AfterUpdate false If true, execute after updating.
BeforeDelete false If true, execute before deleting.
AfterDelete false If true, execute after deleting.
BeforeOpeningPage false If true, executes before the page is displayed.
BeforeOpeningRow false If true, executes before the row is displayed.
Body "context.Log('test');" Write the script to be executed.

Loading A Script From An External File

If you create a text file with the extension .js added to the json file in the same directory as the json file, you can load the body from an external file. The file name of the external file for sample.json is sample.json.js.

Code Samples

In the example below, for site ID:2, the body script is executed before the screen is displayed by "BeforeOpeningPage": true.

Script
{
    "Name": "Sample",
    "SiteIdList": [2],
    "BeforeOpeningPage": true,
    "Body": "// Write an arbitrary script."
}

Supported Versions

Supported versions Body
1.4.16.0 and later Added BeforeBulkDelete and AfterBulkDelete to the parameters