Implemented script task

Introduction

Script tasks help you perform custom tasks with automation. You can add scripts as needed and integrate them with automation. The script task in the automation helps to provide the code to perform the function, those are not available in the built-in task and automation. It’s a combination of multiple tasks and transformation in a single script.

Overview

Automation scripts are small, targeted code that can extend your product. The automation script consists of a starting point, variables with appropriate binding values, and source code. Use the wizard to create a component of the automation script. You are creating a script and a starting point, or you are creating a starting point and linking the starting point to an existing script. Use scripts task in your automation to implement functional rules, attribute validation, workflow or escalation actions, and conditional logic for your application's workflow and security. Automation script tasks allow you to reduce the time it takes to automate tasks because you do not have to recompile files or restart the server.

Create automation scripts to automate routine application tasks. You can use the wizard provided to create scripts and launch points with relevant variables and bindings. You can also use the wizard to associate the launch point with an existing script. You can add a script that can be run as a synchronized job in the product.

If you want to do something quickly in the background. You can customize the integrated message processing transaction by implementing the object structure, public channels, business services, and call channel integration components using automation scripts. Before customizing the application, you can debug the script to fix the problem. You can place print statements in your script to capture script-specific protocols. Script task log statements are automatically sent to the automatic script logger. You can display error messages to users in scripts. It will help you to reduce errors and ensure productivity.

Benefits of Script Task

  • Scripts task in the automation provides default variables and bindings to enhance the functionality.

  • It reduces the complex process of adding a script in the automation and can be used easily in any automation.

  • It is easy to develop and implement in any automation.

  • The scripts can be enabled/disabled at run time without any outage.

  • A single script can be used for many attributes based on the requirement.


Steps to use Script task

  1. Click on the automation tab from the sapper home page.

  2. Now select the desired automation on which you wanted to add a script from the given list.

 

 

3. Drag and drop the script task in the automation and click on it. The below form will appear on the left side of the screen.

4. Add a name and an appropriate description.

5. In the script type input field, select JavaScript. A script type specifies the type of the script.

6. In the response type you need to select the desired one. Here we have a select string.

7. Now select or provide the argument from the argument field.

8. Provide the value in the value filed as required.

 

9. Then, select the script function name as per the script, click on add script button and a box will appear on the screen.

10. Add the custom script as per the requirement and click on validate.

 

11. The response type input field deals with the type of response that the system will return as per the script. It could be an integer, object, array, or string. A response type is an enumerated string value specifying the type of data contained in the response.

12. Add the arguments according to the provided script. Arguments passed to a script are processed in the same order in which they're sent.

13. Now, in the value input field, data could be fed as per the argument in the script. The value field is used as a common format to exchange tabular data between spreadsheets and relational databases. You can add the desired data slot by dragging it from the data slot and dropping it into the value input field. For every argument, the user needs to add value.

14. Then, click on output meta to upload and provide the sample output data. Output meta is the typical resolution for the result of a component. Each component can provide either static or dynamic metadata for the payload and attributes, isolated from each other.

15. You will get the option of providing the file name in the output meta, or as mentioned can also add an external file by selecting the browsing option.

16. Click on save to successfully save the configuration.