Hello Account (Visualforce Remote Objects)

Visualforce Remote Objects で Hello Account。

<apex:page>
  <apex:remoteObjects >
    <apex:remoteObjectModel name="Account" jsShorthand="Acct" fields="Id, Name">
      <apex:remoteObjectField name="Text1__c" jsShorthand="txt"/>
    </apex:remoteObjectModel>
  </apex:remoteObjects>

  <script>
    var doGetAccounts = function() {
      new SObjectModel.Acct().retrieve({ limit: 5 }, function(err, records, event) {
        if(err) {
          console.log(err.message);
        } else {
          records.forEach(function(record) {
            console.log(record.get("Name"));
          });
        }
      });
    };
  </script>

<button onclick="doGetAccounts()">Hello Account</button>

</apex:page>

コメントを残す