Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let uri = "https://api.smartsheet.com/2.0/search/sheets/";
let sheetId = inputData.sheetId;
let productCode = inputData.productCode;
let options = {
method: 'GET',
headers: {'Authorization': 'Bearer '+inputData.token}
};
productCode = parseInt(productCode,10);
fetch(uri+sheetId+'?query="ID'+productCode+'"', options)
.then(function(res) {
return res.json();
}).then(function(json) {
if(json.totalCount == 0){
callback(null, {"rowId":0});
}else{
let array = json.results;
let rowId = 0;
for (let index = 0; index < array.length; index++) {
if(array[index].objectType = "row"){
rowId = array[index].objectId
break;
}
}
callback(null, {"rowId":rowId});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.