You need to sign in to do that
Don't have an account?
zach
Not getting an error when updating non-nillable to null...
Hi, I've built a page that updates the lead object & when I try to update the Company or LastName fields with null, it doesn't throw an error in the saveResult... It doesn't update to null & the data stays the same, but it's not throwing an error. Just wondering if this is a known issue and what I should do, otherwise, if it is.
Thanks,
-Zach
Here's a code snippet if you need it:
Code:
Thanks,
-Zach
Here's a code snippet if you need it:
Code:
function saveLead() { var updateArray = new Array(); var _value = leadSql[0]; _value.set('Company',document.getElementById("editCompany").value); _value.set('Street',document.getElementById("editStreet").value); _value.set('City',document.getElementById("editCity").value); _value.set('State',document.getElementById("editState").value); _value.set('PostalCode',document.getElementById("editZip").value); _value.set('Country',document.getElementById("editCountry").value); _value.set('DUNS_Number__c',document.getElementById("editDUNS").value); _value.set('Location_Type__c',document.getElementById("editLocationType").value); _value.set('Servicing_Division__c',document.getElementById("editServicingDivision").value); _value.set('LeadSource',document.getElementById("editLeadSource").value); _value.set('Salutation',document.getElementById("editSalutation").value); _value.set('FirstName',document.getElementById("editFirstName").value); _value.set('LastName',document.getElementById("editLastName").value); _value.set('Phone',document.getElementById("editPhone").value); _value.set('Fax',document.getElementById("editFax").value); _value.set('Lead_Group__c',document.getElementById("editLeadGroup").value); _value.set('Title',document.getElementById("editTitle").value); _value.set('Email',document.getElementById("editEmail").value); _value.set('Status',document.getElementById("editLeadStatus").value); _value.set('Call_Wrap_Code__c',document.getElementById("editCallWrap").value); _value.set('Invalid_Prospect_Reason_Code__c',document.getElementById("invalidProspectReason").value); _value.set('Do_Not_Contact__c',document.getElementById("editDoNotContact").value); _value.set('Description',document.getElementById("editDescription").value); updateArray.push(_value); var updateVal = sforceClient.Update(updateArray); //alert(updateVal); if(updateVal[0].success == true) { alert("Your changes have been saved"); } else { alert("There was a problem with the data you entered. Please edit and try again."); } }
I'm not actually trying to set it to null. All I want to do is be able to catch errors when fields don't update and if someone tries to set a non-nillable field to null, I want to catch that error and let them know. If I try to set a non-nillable filed to null right now, the saveResult update comes back as successful, but the data doesn't change. I guess I could just validate before submission & skip it altogether.
Code: