2

The values in a cell return null if they are of type number, date, etc. I get the field names and values from Salesforce object firstly. I change them and update them. If the fields are text fields in sobject definition, there is no problem. Can you please help? Thanks!

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];

var dataRange = ss.getDataRange();
var data = getRowsData(sheet, dataRange,1);  
for(var i = 1; i < data.length; i++){

    if(data[i][1] == null){
      // if it is a "number,date,picklist,currency,percent"
    }
    else{
      // do something
    }
 }
4
  • I now figured out, that the field types are not a problem. The problem is the "underscore". The API names are like build_stage__c. This names becomes buildstage. I don't know why?
    – orsan
    Jul 21, 2014 at 13:59
  • var data = getRowsData(sheet, dataRange,1); This row converts build_stage to buildstage.
    – orsan
    Jul 21, 2014 at 14:10
  • Please explain more about what you are trying to do here. Are you trying to pull data into Google Apps from Salesforce or into Salesforce from Google Apps?
    – Jagular
    Jul 21, 2014 at 14:35
  • I'm trying to push data to Salesforce.
    – orsan
    Jul 21, 2014 at 14:46

1 Answer 1

0

Try changing

if(data[i][1] == null){
  // if it is a "number,date,picklist,currency,percent"
}

to

if(data[i].isEmpty[1] == true){
  // if it is a "number,date,picklist,currency,percent"
}

Not all data types will evaluate to null. But, most any will evaluate to whether or not the array cell is empty. I've not done anything with Google Apps, so am basing this on how SF handles different data types.

0

You must log in to answer this question.

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