Last active
November 17, 2019 02:54
-
-
Save chechedotmx/cde9c2ce20c2097b7e0ffa34391e98e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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