I am trying to create a data connector for HubSpot and have been banging my head against the wall trying to figure this out. As far as I can tell, I'm doing everything correctly but the request object in the getData call is missing one of my fields I've specified in my schema.
When I check the logs, getSchema is returning both fields but for some reason, I only appear to be getting one. I've included the code and logs below:
function getData(request) {
console.log("ORIGINAL FIELDS FOR GETDATA(): " + JSON.stringify(request.fields));
switch (request.configParams.apiEndPoint) {
case "sources":
var url = API_URL + "/analytics/v2/reports/totals/summarize/daily?start=" + startYYYYMMDD + "&end=" + endYYYYMMDD;
break;
case "stages":
console.info("Fetching for Stages API");
var url = API_URL + "/deals/v1/pipelines/default";
getPipelineData(request, url);
break;
}
}
function getPipelineData(request, endPoint) {
var header_row = [];
console.log("FIELDS: " + JSON.stringify(request));
request.fields.forEach(function(field) {
for (var i = 0; i < mySchema.length; i++) {
console.log("for loop i: " + i);
console.log("mySchema[i]: " + JSON.stringify(mySchema[i]));
if (mySchema[i].name === field.name) {
console.log("Matched " + mySchema[i].name + " to " + field.name);
header_row.push(mySchema[i]);
} else {
console.error("Did not match " + mySchema[i].name + " to " + field.name);
}
}
});
You can see in the log on about row 5 that getSchema is returning 2 fields, "label" and "stageId." Yet, the next line down in the log is showing the object being used by getData only has one field, "label."
I have NOT, for the life of me, been able to figure out where I'm going wrong here and could really use some help!
Here's a link to the log output: https://www.screencast.com/t/rpD7oz5ZuDdv