NOVA Widget

Dynamic fields from Google Sheets
in Kommo

The widget allows you to create interdependent lists, with a large amount of data in Kommo fields.
Configuring the widget
In the link field, insert a link to the Google Spreadsheet, to add multiple tables, click on plus +, click on the Save button
How to use the widget
Add fields from the table, in our case it is the Make and Model

Important: The names of the fields must be unique, i.e. in the lead or in the company or in the contact there should be only one field with the name of the Brand and one field with the name of the Model. If there are 2 fields with the same name in the lead, then the widget will not be able to find the field you need, similarly, if there is a field with the Brand name in the lead and there is a field with the same name in the company /contact, then the widget will not be able to find the field you need.


When you click on the Brand field, suggestions of car brands will appear or start entering the brand in the field. After selecting a brand, click on the Model field and the models of the selected brand will appear
auto-uploading fields

After preparing the data table:

1. Go to "Extensions" -> "Apps Script"

2. Paste the following code into the editor


function createTrigger() {

var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();

var triggers = ScriptApp.getProjectTriggers();

for (var i = 0; i < triggers.length; i++) {

if (triggers[i].getHandlerFunction() === 'onEdit') {

return;

}

}

ScriptApp.newTrigger('onEdit')

.forSpreadsheet(spreadsheet)

.onEdit()

.create();

}


function onEdit(e) {

var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();

var activeSheet = e.source.getActiveSheet();

var sheetId = activeSheet.getSheetId();

var baseUrl = spreadsheet.getUrl();

var fullUrl = baseUrl + "?gid=" + sheetId + "#gid=" + sheetId;

var url = "https://sp1-nova.ru/api/gt-cache-update/";

var payload = {

url: fullUrl,

subdomain: "subdomain"

};

var options = {

method: "post",

contentType: "application/x-www-form-urlencoded",

payload: payload,

muteHttpExceptions: true

};

try {

var response = UrlFetchApp.fetch(url, options);

Logger.log("Sheet: " + activeSheet.getName() + " (gid: " + sheetId + ")");

Logger.log("Sent URL: " + fullUrl);

Logger.log("Response code: " + response.getResponseCode());

Logger.log("response body: " + response.getContentText());

} catch (error) {

Logger.log("Request error: " + error.toString());

}

}

3. Instead of subdomain, you need to write your subdomain without .kommo.com

4. Then click on Save

5. Select createTrigger and click run, give all permissions

6. Click on Run


Now, when the table is changed, it will be automatically uploaded to Kommo.

Made on
Tilda