Modifying built-in scripts
Modification of built-in scripts
If you wish to modify an automation script that is defined by another extension (such as CRM scripts) you have two options; to create a modified copy or overwrite scripts.
Create a modified copy
-
copy the extension source (clone the repository or copy the files),
-
modify the source as you see fit,
-
deploy your version instead of the original version.
Overwrite the scripts
Corredor assigns unique names to each automation script. The name is generated from the file path.
# The CRM extension
/ server-scripts
/ crm
/ Lead
/ SetLabel.js
The SetLabel.js
script script is assigned /server-scripts/crm/Lead/SetLabel.js:default
as the name.
To overwrite the SetLabel.js
script, you must define a script that will be assigned the same name (essentially has the same path).
# The CRM extension
/ package.json
/ node_modules
/ server-scripts
/ crm
/ Lead
/ SetLabel.js # 👈 We're targeting this one
/ AnotherScript.js
# Your extension
/ package.json
/ node_modules
/ server-scripts
# To overwrite something in the CRM extension
/ crm
/ Lead
/ SetLabel.js # 👈 This version will replace the CRM version
# The rest of your code goes here
/ extension
/ Lead
/ SomeScript.js
For this to work, you must make sure that your extension is included after the extension you wish to modify. For example:
|