I want to be able to set multiple $p.events.on_editor_load
Answer¶
This can be achieved in one of the following ways.
1. Add the process you want to execute to an array, and call the processes stored in the array in sequence with $p.events.on_editor_load.
1. Define the process you want to execute as a single function, and call the function in sequence with $p.events.on_editor_load.
Overview¶
If you write $p.events.on_editor_load multiple times across multiple script files, the scripts will be overwritten and only the most recent one will work. There are two ways to work around this:
1. Add the process you want to execute to an array, and call the processes stored in the array in sequence with $p.events.on_editor_load.
1. Define the process you want to execute as a single function, and call the function in sequence with $p.events.on_editor_load.
In addition to $p.events.on_editor_load, the same problem occurs with $p.events.on_grid_load and other "Event Firing Script," and can be avoided with this content.
1. Add the process you want to execute to an array, and call the processes stored in the array in sequence with $p.events.on_editor_load¶
Sample Code¶
JavaScript¶
JavaScript¶
JavaScript¶
JavaScript¶
//Execution
$p.events.on_editor_load = function() {
for (let i = 0; i < $p.events.on_editor_load_arr.length; i++) {
$p.events.on_editor_load_arr[i] ();
}
}
Register the following in Pleasanter's "Script".

Register the "Define an array" script at ID=1, and the "Execution" script at ID=4. Register the scripts to add the processes you want to execute at ID=2 and ID=3. In this example, two processes are added, but you can add any number of processes by writing them between ID=1 and ID=4.
2. Define the process you want to execute as one function, and call the functions sequentially with $p.events.on_editor_load¶
Sample¶
JavaScript¶
JavaScript¶
JavaScript¶
Register the following in the "Script" of Pleasanter.

Register the script for the function defined with ID=1,2. Register the "Execution" script with ID=3. In this example, two processes are added, but you can add as many processes as you want by listing them before ID=3.