Execute standalone functions | Zoho Sprints Help

Execute standalone functions

Use standalone functions to process data that are operated by external parameters. Zoho Sprints provides the ability to create functions and use REST APIs to execute them to arrive at simple business solutions. These functions can be triggered from third party services or the web.

Standalone functions can be executed in two ways: Creating schedule to execute the functions or using APIs to execute them.

Scenario 1: Execute via schedule

Info
Let's assume as an admin user you need to notify users of overdue work items. To meet this requirement, you can create a standalone function to send weekly email reminders with an attached file containing the list of overdue items. You can create a recurring weekly schedule for the function to be executed periodically. With a one-time scripting effort, you could automate a critical business process.

Scenario 2: Execute via API

Info
Let's assume you are trying to invoke a function from Zoho CRM. When you are adding a new lead to your CRM, you want to create a corresponding work item in Zoho Sprints. To achieve this, you need to pass the Item fields as custom parameters.

Create standalone function

To create a standalone function:
  1. Click the gear icon at the top-right. The settings window will appear.
  2. Select Custom Functions under Automation.
  3. Click the dropdown on the Function button.
  4. Select the Function. The Create Custom Functions window will appear.
  5. Enter Display Name.
  6. Enter Function Name.
    Note: According to the general naming convention, function name cannot contain spaces.
  7. Select Category as Standalone.
  8. Select the Recurrence Type to determine the frequency at which the function needs to be executed.
  9. Enter schedule specifications based on the recurrence type.
  10. Provide a Description of the function.
  11. Script the function using the Deluge script builder.
  12. Click Save to complete creating the function or click Save and Execute to complete creating the function and execute it.
 

Execute function using API

APIs enable you to execute a function remotely using the function's unique ID.

Info
https://sprintsapi.zoho.com/zsapi/team/{teamId}/customfunction/{functionId}/execute/?arguments={"parameters":{"key1":"value1","key2":"value2", ....upto 25 parameters }}

Access parameter

You can pass custom parameters in standalone functions. Parameter refers to the value that is passed in the function. Passing this value in the function enables you to get the required response or output. The format for the parameter is that of key value pairs.

Info
To access param "key1" in deluge, enter value = sprintsAPIRequestMap.toMap().get("params").toMap().get("key1");
 
Notes
Note:
  1. You can customize the status code and send custom headers in your request.
  2. You can enter up to 25 parameters.
 

Define response object

Define the format in which the response of the API needs to be. The default response format in functions is JSON when the return is null. However, Sprints standalone functions support other formats like XML, HTML and Plain Text where you need to map object. The response format data has to be given to “sprintsAPIResponse" key in a map if you wish to format default response format