Client Scripts are used to incorporate additional validations to business data while they are recorded in Qntrl. In client scripts, you can code using JavaScript and run the code on the end-user’s browser while they are creating a new card or updating an existing card in Qntrl.
Business use cases
Client Scripts can be used to,
-
Perform mathematical calculations and validations on field data
- Auto-populate fields based on end-user input
-
Fetch data from third party applications or websites
- Track delays and capture causes for delay
-
Display field values based on users, roles, and profiles
- Carry out validations on field data entered by end-user
-
Throw alerts and messages for field validations
When are client scripts executed?
Client Scripts are executed based on one of the following triggers:
-
On loading a page (onLoad)
-
On submitting a page (onSubmit)
-
On changing a field value (onChange)
Only one execution trigger can be associated with a client script.
Add client script
-
Navigate to
and select
Client Scripts
under
Scripts
in the menu.
-
Click
Add Script
.
-
Enter the script details on the right panel.
-
Script Name: Enter a name for the script.
-
Form: Select a form for which the script must be executed.
-
Execution Location: Select one or more locations in which the script must be executed.
-
Add new Card: This refers to the page which appears when Add Card button is clicked.
-
Card details: This refers to the page that appears when a card name is clicked.
- Transition: This refers to the page that appears when the transition is performed.
-
Execution Trigger: Select a condition upon which the script’s execution must be triggered.
-
onLoad- Select this option to execute the script when a page loads.
-
onSubmit- Select this option to execute the script when a page is saved or published.
-
onChange- Select this option to execute the script when a page is updated. On selecting this, a Field dropdown is displayed in the right panel, where you can choose the fields whose update must trigger the script.
-
Code your script using the editor on the left.
-
Click the
?
icon at the top-right corner of the editor to use fields of the selected form.
-
Click
Save as Draft
if you do not want the script to be executed right away.
-
Otherwise, click
Publish
to activate the script.
Set execution order of scripts
When more than one client script is created for a single form, the order in which the scripts must be executed can be predefined.
-
Navigate to
and select
Client Scripts
under
Scripts
in the menu.
-
Click
Set Execution Order.
-
Select a
Form
and
Execution
Trigger
from the dropdown.
-
Enter numbers to indicate the
Execution
Order
corresponding to each script.
-
Click
Save
.
Client scripts can be filtered and viewed based on Forms. To filter scripts,
-
Navigate to
and select
Client Scripts
under
Scripts
in the menu.
-
Click
near
All
Forms
column and select a form from the dropdown.
Only scripts from the selected form will be listed.
Enable or disable scripts
All published client scripts will be enabled by default. However, scripts can also be disabled to stop its execution temporarily.
-
Navigate to
and select
Client Scripts
under
Scripts
in the menu.
-
Toggle the button under the
Active
column to
NO
or
YES
to disable or enable the corresponding script.
Disabled script will not be executed until it is enabled again.
Delete script
If you no longer require a client script, it can be deleted. To delete a script,
-
Navigate to
and select
Client Scripts
under
Scripts
in the menu.
-
Hover over a script name and click
button.
-
Select
Delete
from the pop-up.
-
Confirm your action.
Deleted scripts cannot be recovered.