I'm passing a Javascript object through JS Remoting to update an Account record. However, if I update the NumberOfEmployees field, I'm getting the following
INVALID_TYPE_ON_FIELD_IN_RECORD Employees: value not of required type: 1: [NumberOfEmployees]
String-type fields seem to work just fine. Is there something I'm missing about Integers?
The Apex:
@RemoteAction
public static void putAccount(Account a){
update a;
}
The javascript:
function Account(){
this.Id = null;
}
function putAccount(){
var acct = new Account();
acct.Id = document.getElementById("accountPutId").value;
acct.NumberOfEmployees = parseInt(document.getElementById("accountPutNumEmp").value);
console.log(acct);
AccountRemote.putAccount(acct, function(result, event){
console.log(event);
});
document.getElementById("accountPutId").value = "";
document.getElementById("accountPutName").value = "";
}
The JSON object logged to console just before the Remoting call:
Account {Id: "001o000000BbbzbAAB", NumberOfEmployees: 1}
Account.Name works with this just fine. Am I missing something obvious?