You need to sign in to do that
Don't have an account?
澄人 鈴木 (Sumito)
Returned "Undefined" when using Google apps script to downloading Account data from Opportunity
Returned "Undefined" when using Google apps script to downloading Account data from Opportunity. Please help me to get proper record from Field "Account.Name".
Copied following method.
https://gist.github.com/stomita/990589
Modified as followings:
from: Opportunity
fields: Id,Account.Name
----
// Query account data from Salesforce, using REST API with OAuth2 access token.
var fields = "Id,Account.Name";
var soql = "SELECT "+fields+" FROM Opportunity LIMIT 100";
var queryUrl = instanceUrl + "/services/data/v21.0/query?q="+encodeURIComponent(soql);
var response = UrlFetchApp.fetch(queryUrl, { method : "GET", headers : { "Authorization" : "OAuth "+accessToken } });
var queryResult = Utilities.jsonParse(response.getContentText());
----
Copied following method.
https://gist.github.com/stomita/990589
Modified as followings:
from: Opportunity
fields: Id,Account.Name
----
// Query account data from Salesforce, using REST API with OAuth2 access token.
var fields = "Id,Account.Name";
var soql = "SELECT "+fields+" FROM Opportunity LIMIT 100";
var queryUrl = instanceUrl + "/services/data/v21.0/query?q="+encodeURIComponent(soql);
var response = UrlFetchApp.fetch(queryUrl, { method : "GET", headers : { "Authorization" : "OAuth "+accessToken } });
var queryResult = Utilities.jsonParse(response.getContentText());
----
Ashwani
I think authorization header is wrong. It should be:
澄人 鈴木 (Sumito)
Thanks for your advise. I tried with the authorization header you recommend but the result was same as before.