-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
Description
Post about extension points...
Mhz matt a great tldr about this.
mhz
TIL: How scripted extension points work.
BENEFIT: You can define a script include where the same methods have different implementations for different circumstances.OVERVIEW:
- In the [sys_extension_point] table, define a script include to serve as interface definition (method signatures and their return types).
- On the record you made in step Create CODE_OF_CONDUCT.md #1, use "Create Implementation" button to generate a copy of the interface script include, then edit the generated file to handle a specific circumstance.
you can do this multiple times to create alternate versions of the script include with same method names but different implementations.
each include has a boolean method which can tell if its applicable to the current situation.
Its "handles()" method, can initialize internal variables if needed, then returns a boolean to the caller, true if it applies or false means to ignore it.
Example: handles: function() { return record.type=="incident" };- Create a wrapper script to call the implemented script include(s)
wrapper asks for a list of the "extensions" for a script include name
loops thru each "extension" calling the boolean "handles()" method, followed by other desired method if handles() returns true.
USE CASE: There are many use cases but the one I'm envisioning is when there are multiple different customer integrations for the same table, each with different rules.
DISCLAIMER: I'm basing this on studying work of others. I haven't built it myself yet. (edited)