Problem I am currently working on developing an action for use in Salesforce1 to create a new record of a custom object using a visualforce page and javascript. I'm fairly new to this and can't seem to find what I'm doing wrong anywhere...
<apex:page docType="html-5.0" title="Create Location">
<apex:remoteObjects >
<apex:remoteObjectModel name="Location__c" fields="Id,VIN__c"/>
</apex:remoteObjects>
<div class="mypage">
VIN:
<input type="text" id="myVIN"/>
<button onclick="createLocation()">Create Location</button>
</div>
<script>
function createLocation() {
var myVIN = document.getElementById("myVIN");
var location = new sforce.SObject("Location__c");
location.create({VIN__c: myVIN});
}
</script>
</apex:page>
My custom object is Location__c. The it's only custom field is VIN__c, which is required to be input on record creation.
I'm guessing something is going wrong in the createLocation() js function but I'm not too sure. All the examples I could find only work with standard salesforce objects.