Scriptlets can be applied to different areas of the system allowing extended functionality for customers. They can be added to the following parts of the system:
• | Responses |
• | Area Changing |
• | Login / Logout |
• | Exiting on fields (on panels and tabs) |
• | Dialing (via user’s dialing method) |
• | As a panel |
All Scriptlet's have some variables available to them which can be used to access data on the event that triggers the Scriptlet to run as well as offer a connection to the database. Below are some examples of Scriptlets and the variables available to them.
RESPONSE SCRIPTLET:
Add a scriptlet to a response by going to Menu > Setup > Responses > Click on a response > Workflow > Scriptlet
AREA CHANGE SCRIPTLET:
Add a scriptlet to run on area change by going to Menu > Setup > Users > User Profiles > Click on a user > Scriptlets > Run scriptlet on Area change
LOGIN/LOGOUT SCRIPTLET:
Add a scriptlet to run on login/logout by going to Menu > Setup > Users > User Profiles > Click on a user > Scriptlets > Run scriptlet on Login/Run scriptlet on Logout
PANEL/TAB FIELD EXIT SCRIPTLET:
Add a scriptlet to run on field exit by going into an account, editing the view, editing a panel or tabbed panel, then selecting a field and select a scriptlet from the drop-down.
DIALLING SCRIPTLET:
Add a scriptlet to run on dial/hangup by going to Menu > User > Dialing Method selecting ‘Scriptlets’ then selecting a scriptlet to run on Dial and Hangup.
PANEL SCRIPTLET:
Add a scriptlet to run in a panel by going to Menu > Setup > Panels > Panels, select ‘New Panel’ and ‘Embedded Scriptlet’ as the panel type. The scriptlet can be set in the ‘Extra Options’ drop-down. Once saved, this panel can be added to a view.
ENDPOINT SCRIPTLETS:
Useful examples of code:
Scriptlets available via an endpoint can have their own custom output. To achieve this, simply echo the output you want the endpoint to return. If no output occurs when running the scriptlet, then we will respond with one of the below JSON responses.
Sending an email (Note that this function will use the current user’s SMTP settings then fallback to the database area SMTP and finally the system/global SMTP if the previous options are not available)
Accessing the database (Note that it is important to check if the result of queries has results before attempting to access them)
Making a HTTP request:
A note about approval:
Any scriptlets uploaded during or before release 7.9 will be available instantly within the system, without approval. However, future uploads to scriptlet's will require approval from a member of FIVE CRM Support Team. Once uploaded the Support Team will receive a notification that this needs to be reviewed/approved.
When considering a scriptlet for approval we will be looking for the following:
• | Clean, well-written and documented code which is easy to understand and therefore maintain. |
• | Huge operations are not permitted so please ensure processes are reasonable. |
• | Security. Code must be secure and follow best practices for security. |
Once a scriptlet has been approved, it is instantly available within the system. If an update was requested to a scriptlet, then once approved, areas of the system using it will update to use the new version automatically.
Scheduling a scriptlet and requesting an endpoint link for a scriptlet will also require approval by Support. Once approved, the user who made the request will be emailed with an endpoint used to run the scriptlet. An API hash will need to be appended to the end of the URL for authentication.
An email will be sent to the user who requested changes to the scriptlet once approved.
For any further questions, please contact support@fivecrm.com