Using Server Scripts and Jobs & Google Workspace to Manage KPIs - A Case Study

A few months ago, Vtiger introduced the Server Scripts and Jobs feature in the VTAP platform. This article explores a practical application of this feature and showcases how the Vtiger team uses it internally to keep team members informed about their Key Performance Indicators (KPIs).

Challenge: Keeping Teams Updated on KPIs

The Vtiger engineering team comprises smaller units focusing on performance, security, user experience, and customer issues. Each team has its own set of KPIs to track progress against goals. To ensure everyone stays informed, we wanted a way to update teams on their targets and current performance regularly.

Solution: Google Spaces and VTAP Server Scripts and Jobs

We utilize Google Workspace for internal communication, including Google Chats and Google Groups. Each team has a dedicated Google Space with members who directly influence the metrics and are responsible for achieving targets.

Google Chats offers webhooks for sending automated messages to Spaces. You can configure these webhooks by navigating to Space Settings > Apps and Integrations > Webhooks > Add Webhook.

For each team, we created a dedicated Space. For instance, the Ferrari group tracks performance issues captured by internal tools and reported by customers. These issues are categorized by impact and assigned priority levels with corresponding weightages. Critical issues affecting multiple users or servers receive the highest weight (e.g., 10 points), while issues confined to specific users or features receive lower weightage (e.g., 5 points). We aggregate all reported issues and calculate an index score. A higher score indicates a greater need for resolution, while a lower score signifies positive progress.

The update frequency for each team varies based on their workflow. Customer-facing teams require daily updates at 10:00 AM to stay on top of critical issues. Performance teams, whose work involves analysis and validation, receive updates twice a week to allow for thorough investigation before releasing fixes.

Creating a Scheduled Job for Daily Updates

Here's how we set up a server-side job to remind the customer-facing team about their score every day at 10:00 AM:

  1. Navigate to the Platform app in the main Menu and select Server Jobs.
  2. Create a new Server Job. These function similarly to cron jobs and have a two-minute execution limit.

Server Job Functionality

Requirement: Send a daily notification about the customer issue index to Google Space.

Solution:

  • We leveraged Vtiger's web service APIs to access report data. 
  • A custom report in Vtiger was created to count open issues categorized by priority.
  • Issues were reported within Vtiger's Tasks module.
  • The server script utilized VTAP's HTTP APIs to access the report and fetch data in JSON format.
  • Scores were calculated and aggregated, and a template was prepared for sending the information to the Space webhook.
  • Finally, VTAP's HTTP APIs within the server job transmitted the details to the Space.
  • Note: More will be discussed about the new web service APIs in the coming months.

Scheduling: The server job frequency ensures timely information delivery to the group.

Code


  

asyncfunctionmain() { //Type your code here let url = "https://YOUR_ACCOUNT_URL/api/records/data?module=Reports&id=REPORT_ID"; var USERNAME = 'VTIGER_USERNAME'; var PASSWORD = 'VTIGER_PASSWORD'; var authHeader = btoa(USERNAME+":"+PASSWORD); var options = {           headers: {Authorization: 'Basic '+authHeader}       } var response = await vtap.macro.http.get(url, options); var body = JSON.parse(response.body); //extract information from the report. let data = {}; for(let i in body){ if("Bug" === body[i]["Calendar.tasktype"]) {         data[body[i]["Calendar.taskpriority"]] = body[i]["record_count"];     } } if(!data["URGENT"]) data['URGENT']=0; if(!data["High"]) data['High']=0; if(!data["Medium"]) data['Medium']=0; if(!data["Low"]) data['Low']=0; let text = "\n\n Today's open bugs tasks count - "+ newDate().toDateString()+'\n -------------------------------------\n'; text = text + "URGENT Tasks - "+data["URGENT"]+"\n"; text = text + "High Tasks - "+data["High"]+"\n"; text = text + "Medium Tasks - "+data["Medium"]+"\n"; text = text + "Low Tasks - "+data["Low"]+"\n"; text = text + "Performance Index Score : "+ ((10 * parseInt(data["URGENT"])) + (5 * parseInt(data['High'])) + (3 * parseInt(data['Medium']))) + "\n"; var options = {         headers : { 'contentType': 'application/json'         }, 'body' : JSON.stringify({'text':text})     }; let chatWebhookURL = "https://chat.googleapis.com/v1/spaces/zz/messages?key=yyyyyy&token=xxxxx";     vtap.macro.http.post(chatWebhookURL,options); }


  

asyncfunctionmain() { //Type your code here let url = "https://YOUR_ACCOUNT_URL/api/records/data?module=Reports&id=REPORT_ID"; var USERNAME = 'VTIGER_USERNAME'; var PASSWORD = 'VTIGER_PASSWORD'; var authHeader = btoa(USERNAME+":"+PASSWORD); var options = {           headers: {Authorization: 'Basic '+authHeader}       } var response = await vtap.macro.http.get(url, options); var body = JSON.parse(response.body); //extract information from the report. let data = {}; for(let i in body){ if("Bug" === body[i]["Calendar.tasktype"]) {         data[body[i]["Calendar.taskpriority"]] = body[i]["record_count"];     } } if(!data["URGENT"]) data['URGENT']=0; if(!data["High"]) data['High']=0; if(!data["Medium"]) data['Medium']=0; if(!data["Low"]) data['Low']=0; let text = "\n\n Today's open bugs tasks count - "+ newDate().toDateString()+'\n -------------------------------------\n'; text = text + "URGENT Tasks - "+data["URGENT"]+"\n"; text = text + "High Tasks - "+data["High"]+"\n"; text = text + "Medium Tasks - "+data["Medium"]+"\n"; text = text + "Low Tasks - "+data["Low"]+"\n"; text = text + "Performance Index Score : "+ ((10 * parseInt(data["URGENT"])) + (5 * parseInt(data['High'])) + (3 * parseInt(data['Medium']))) + "\n"; var options = {         headers : { 'contentType': 'application/json'         }, 'body' : JSON.stringify({'text':text})     }; let chatWebhookURL = "https://chat.googleapis.com/v1/spaces/zz/messages?key=yyyyyy&token=xxxxx";     vtap.macro.http.post(chatWebhookURL,options); }

 

Benefits

This approach automated the process of notifying teams about their KPIs. Currently, we use to ensure everyone stays informed and focused on achieving their goals.

It also helps improve efficiency and the productivity of your teams.

 

Benefits

This approach automated the process of notifying teams about their KPIs. Currently, we use to ensure everyone stays informed and focused on achieving their goals.

It also helps improve efficiency and the productivity of your teams.

 
 
 

Coming soon on VTAP

 
 

The Data Connector Designer module offers user interface and helps integrate with other applications.

You can see application data within the Vtiger interface without storing the data in Vtiger. You can also enable a more secure and easier way to implement automation flows that depend on external data without copying the data to the CRM.

Stay tuned to learn more about this in the coming months.

 

The Data Connector Designer module offers user interface and helps integrate with other applications.

You can see application data within the Vtiger interface without storing the data in Vtiger. You can also enable a more secure and easier way to implement automation flows that depend on external data without copying the data to the CRM.

Stay tuned to learn more about this in the coming months.

 
 

Sign up to receive the latest updates!