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);
}