Table of Contents
Create
Click + Add Code to open the Create New Service or Library modal.
This lets you use the code libraries to build code. Give the code service a one-word name for the system to refer to and click Create.
Code Editor
Add code to the window to run.
Pick code libraries to use in your code (log is added by default). Choose the clearblade library to interact with the ClearBlade Platform.
3. Edit test parameters.
4. Save and test the code, and the results appear.
5. Turn the log toggle on to keep track of the code results.
Debugging
ClearBlade provides a simple but flexible logging facility to debug your code service.
1. Ensure the log toggle is on.
2. When you create/edit your code service, you can embed log() calls strategically to monitor execution progress.
3. You can run/test the code service. This window should pop up after it executes.
4. There will be a log list starting with the most recent one to return to.
5. When you have finished debugging, and your service works perfectly, you can turn off logging by switching the toggle. You do not have to remove the logs from the code (they become noop statements).
Trigger Pane
Add Trigger
Click on + Add Trigger.
Enter a name
Enable or disable the trigger
Select a source and action
Click Create Trigger when done.
See Trigger Source for a source and action list.
Update Trigger
The only items that can be updated in the trigger are whether to enable/disable the trigger and the items that appear after an action (such as a collection).
Click Update Trigger after making an edit.
Delete Trigger
Click Delete on the right of the trigger and click confirm when prompted.
Timers Page/Pane
Timers can be created on the Timers page (inside a system) or pane (on the Code Service Page).
Add the timer information and click Create Timer. The timer should be listed on the Timers page.
Click on the timer to make updates (you cannot update the name). Save changes by clicking Update Timer in the window.
Click on Topic to copy the timer topic path.
To delete, click on Delete on the right of the timer.
Enable/Disable Triggers/Timers
You can disable triggers and timers in the handlers' editing modal. It will display Enabled or Disabled under each timer/trigger.
Webhooks
Click + Add Webhook to add a new webhook. Enter the information in the modal and click Create. The webhook should appear in the list.
The webhook can be deleted by clicking Delete to the right of it.
Clicking the webhook lets you update the modal’s description and auth method. Click Update to update the webhook.
Copy the link to execute the service’s webhook.
Delete, Discard, and Save
Click Delete Service, and a prompt will appear to verify deletion.
Click Discard Changes to delete changes you made in the session. It will take you back to the homepage without a confirmation prompt.
Click Save to save changes made to the service.
Libraries
Create library
Click + Add Code to open the Create New Service or Library modal.
Switch to the Library button. Give the library a one-word name or the system to refer to and a description, and click Create.
Library Code Page
Just like code services, you can write your code. The difference is that you can turn it into a library for code services.
You can also add other libraries to your library. Do not add the current library to itself.
Library Appearance
Your new code library will appear in bold in your code service library list.
Each library is required from a service itself. Some libraries are not listed by default and need to be added. Libraries added later will override earlier ones if conflicts arise.