You could say I'm a real newbie to coding. Right now I'm trying to connect the HubSpot Account to Google Data Studio via Google Apps Script and Google Sheets. I'm starting with simple stuff like in this example:
I tried to build my code like the one in the example above. The problem is, that I'm getting the internal values of the "Deal Stage" and the "Pipeline" (the status if you will) the deals are in instead of the respective labels or names that are "attached" to the internal values (see photo)
Other stuff, like the Deal Name (or "Bewerbermanagementsystem" in the picture) is working properly.
Don't know if this is enough information for you guys, but it would be great if someone could help me, because I really do lack of knowledge in coding :D
Here's the section of the code:
function getDeals() {
var service = getService();
var headers = {headers: {'Authorization': 'Bearer '+ service.getAccessToken()}};
var keep_going = true;
var offset = 0;
var deals = Array();
while(keep_going) {
var url = API_URL + "/deals/v1/deal/paged?properties=dealstage&properties=pipeline&properties=bewerbermanagementsystem&properties=amount&properties=dealname&properties=dealtype&limit=250&offset="+offset;
var response = UrlFetchApp.fetch(url, headers);
var result = JSON.parse(response.getContentText());
keep_going = result.hasMore;
offset = result.offset;
result.deals.forEach(function(deal) {
var dealstage = (deal.properties.hasOwnProperty("dealstage")) ? deal.properties.dealstage.value : 0;
var pipeline = (deal.properties.hasOwnProperty("pipeline")) ? deal.properties.pipeline.value : 0;
var bewerbermanagementsystem = (deal.properties.hasOwnProperty("bewerbermanagementsystem")) ? deal.properties.bewerbermanagementsystem.value : "unknown";
var amount = (deal.properties.hasOwnProperty("amount")) ? deal.properties.amount.value : 0;
var dealname = (deal.properties.hasOwnProperty("dealname")) ? deal.properties.dealname.value : 0;
var dealtype = (deal.properties.hasOwnProperty("dealtype")) ? deal.properties.dealtype.value : 0;
deals.push([stageId,pipeline,bewerbermanagementsystem,amount,dealname,dealtype]);
});
}
return deals;
}