Modifying 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.
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.
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
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.