New script for getting everyone who is in each group and export to CSV. Skan templates. A few other small things

This commit is contained in:
Norm Rasmussen
2024-07-19 16:29:00 -04:00
parent bf0244b2fe
commit da2e0d2c38
108 changed files with 3481 additions and 7 deletions

View File

@ -100,6 +100,7 @@ function updatedDomainsOnly(domains_to_update) {
var corrList = [];
for (var x = 0; x < domains_to_update.length; x++) {
var array = domains_to_update[x];
Logger.log(array)
var currDomain = domains_to_update[x][0]
var errorObj = new Object();
var noErrorObj = new Object();
@ -109,7 +110,6 @@ function updatedDomainsOnly(domains_to_update) {
for (var i = 1; i < array.length; i++) {
var item = array[i]
if (item != "") {
Logger.log("Item/Domain: "+item)
var api_url = 'https://api.northpass.com/v2/groups/?filter[name][eq]='+encodeURIComponent(item);
const settings = {
async: true,
@ -123,15 +123,16 @@ function updatedDomainsOnly(domains_to_update) {
const sendMsg = UrlFetchApp.fetch(api_url, settings);
var uuidResponse = sendMsg.getContentText();
var parseData = JSON.parse(uuidResponse);
var groupName = array.indexOf(item);
if (parseData['data'].length >= 1) {
var groupID = parseData['data'][0]['id'];
var groupName = array.indexOf(item);
if (groupName != -1) {
array[groupName] = groupID;
}
}
correctGroups.push(item)
} else {
errorGroups.push(item);
array[groupName] = "";
}
}
}
@ -146,9 +147,9 @@ function updatedDomainsOnly(domains_to_update) {
sendWebhook({domain_to_update : { domain: dom, group_ids: groups }})
replaceOnSheet(dom, groups);
}
MailApp.sendEmail("nrasmussen@gainsight.com",
"Anthology has submitted a CSV",
"Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList));
// MailApp.sendEmail("nrasmussen@gainsight.com",
// "Anthology has submitted a CSV",
// "Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList));
MailApp.sendEmail("amitd@anthology.com",
"Anthology has submitted a CSV",
"Here are the domains that will be updated: "+JSON.stringify(noErrorObj)+"\n\n"+"Group Errors (they likely don't exist): "+JSON.stringify(errorList));