Created
September 6, 2014 06:42
-
-
Save tyoshikawa1106/60218274d6f234c1d73e to your computer and use it in GitHub Desktop.
RetemoObjects Create
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Account" showHeader="true" sidebar="false" id="page"> | |
<apex:include pageName="RemoteObjectsCreateRemote" /> | |
<div id="vf-page"> | |
<apex:form id="form"> | |
<apex:commandButton value="Create" onclick="return createAccount();" /> | |
</apex:form> | |
</div> | |
<apex:include pageName="RemoteObjectsCreateScript" /> | |
</apex:page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page > | |
<apex:remoteObjects > | |
<apex:remoteObjectModel name="Account" fields="Id" /> | |
</apex:remoteObjects> | |
</apex:page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page > | |
<script type="text/javascript"> | |
function createAccount() { | |
var account = new SObjectModel.Account(); | |
account.set('Name', 'Sample Account'); | |
account.create(function(err, results, event) { | |
if (err) { | |
alert(err.message); | |
} else { | |
console.log(results[0]); | |
location.href = "/" + results[0]; | |
} | |
}); | |
return false; | |
} | |
</script> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment