0

I'm not sure what is causing these errors as when I single them out and run them again, they run just fine. Here is the response log:

[, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1921837509-123724 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1142535715-89221 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1892498218-91728 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 665361479-96176 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 23367811-86680 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 333477079-125651 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1512738979-127867 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 333477079-125654 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 2084632066-128628 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1055812594-101740 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1001679558-110596 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1925299595-116430 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 915420034-74113 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1892498218-91726 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 333477079-125649 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 98981645-70481 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 270290279-133432 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 23367811-86677 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 659221679-101963 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1892498218-91723 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 2084632066-128626 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1001679558-110592 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1624144108-127817 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1705941813-79049 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 2038031309-82474 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1892498218-91727 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1001679558-110590 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1370517856-89833 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1804576979-70358 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 23367811-86678 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1043450133-87585 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1804576979-70366 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 305510904-99594 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 23367811-86675 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 560036644-75760 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 2104806496-100352 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 98981645-70480 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 659221679-101966 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 1512738979-127862 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , [{"message":"An unexpected error occurred. Please include this ErrorId if you contact support: 333477079-125659 (662168627)","errorCode":"UNKNOWN_EXCEPTION"}], , 

You can see just how many errors I am getting.

Here is the primary code I am using to PATCH:

function upsertPage1(object, idCol) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getActiveSheet();
  var data = sheet.getDataRange().getDisplayValues();
  var sfService = getSfService();   //this function gets my SF connections *see notes below*
  var userProps = PropertiesService.getUserProperties();
  var props = userProps.getProperties();
  var name = getSfService().serviceName_;
  var obj = JSON.parse(props['oauth2.' + name]);
  var instanceUrl = obj.instance_url;
  var idCol = colCt1(idCol);   //this function gets a column number from a column letter
  var idField = data[0][idCol];
  var dataJSON = getJSON1(data,idCol);    //this function just gets my sheet data as a JSON
  var requestArr = [];
  for (i=1;i<data.length;i++){
    var id = data[i][idCol];
    var payload = JSON.stringify(dataJSON[i-1]);
    var request = {
      'url': instanceUrl + "/services/data/v42.0/sobjects/" + object +"/" + idField +"/" + id,
      'headers': {Authorization: "Bearer " + sfService.getAccessToken()},
      'contentType': 'application/json',
      'method': 'PATCH',
      'payload': payload,
      'muteHttpExceptions': true
      };    
    requestArr.push(request);
  };
var response = UrlFetchApp.fetchAll(requestArr);
}

What would cause these errors and how do I correct it? I need to consistently and accurately update SF and will be doing this as part of a larger code, so I need it to work right the first time.

I don't have this issue using the Salesforce Data Connector add-on, which leads me to believe this can be fixed.

1 Answer 1

1

It seems like once again I have jumped too soon into the forums.

I found an article somewhere (can't find it again) that suggested rolling back your API version in the HTTP call. I went from v42 to v38 and that seemed to do the trick. Hope that helps others!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .