{"id":4148,"date":"2024-02-29T14:37:57","date_gmt":"2024-02-29T06:37:57","guid":{"rendered":"http:\/\/www.ponybai.com\/?p=4148"},"modified":"2023-12-06T14:42:01","modified_gmt":"2023-12-06T06:42:01","slug":"visualforce-%e8%bf%9c%e7%a8%8b%e5%af%b9%e8%b1%a1","status":"publish","type":"post","link":"http:\/\/www.ponybai.com\/?p=4148","title":{"rendered":"Visualforce \u8fdc\u7a0b\u5bf9\u8c61"},"content":{"rendered":"\n<p>JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b \u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002<\/p>\n\n\n\n<p><samp>@RemoteAction<\/samp><\/p>\n\n\n\n<p>\u5e55\u540e\uff0c\u8fdc\u7a0b \u5bf9\u8c61\u63a7\u5236\u5668\u5904\u7406\u5171\u4eab\u89c4\u5219\u3001\u5b57\u6bb5\u7ea7\u5b89\u5168\u6027\u548c\u5176\u4ed6\u6570\u636e\u53ef\u8bbf\u95ee\u6027 \u5173\u6ce8\u3002\u4f7f\u7528\u8fdc\u7a0b\u7684\u9875\u9762 \u5bf9\u8c61\u53d7\u6240\u6709\u6807\u51c6 Visualforce \u9650\u5236\u7684\u7ea6\u675f\uff0c\u4f46\u4e0e JavaScript \u8fdc\u7a0b\u5904\u7406\u3001\u8fdc\u7a0b\u5904\u7406\u4e00\u6837 \u5bf9\u8c61\u8c03\u7528\u4e0d\u8ba1\u7b97\u5728\u5185 \u8fbe\u5230 API \u8bf7\u6c42\u9650\u5236\u3002\u4f7f\u7528 Visualforce Remote \u5bf9\u8c61\u5305\u62ec\u5728\u540c\u4e00\u9875\u9762\u4e0a\u5b9e\u73b0\u4e24\u4e2a\u5355\u72ec\u7684\u529f\u80fd\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8bbf\u95ee\u5b9a\u4e49\uff0c\u4f7f\u7528 Visualforce \u548c Remote \u7f16\u5199 \u5bf9\u8c61\u7ec4\u4ef6\u3002\u8fd9\u4e9b\u7ec4\u4ef6\u4f1a\u751f\u6210\u4e00\u7ec4 JavaScript \u4ee3\u7406\u5bf9\u8c61\uff0c\u60a8\u53ef\u4ee5 \u5728\u6b65\u9aa4 2 \u4e2d\u4f7f\u7528\u3002<\/li>\n\n\n\n<li>\u6570\u636e\u8bbf\u95ee\u51fd\u6570\uff0c\u7528 JavaScript \u7f16\u5199\u3002\u8fd9\u4e9b\u51fd\u6570\u4f7f\u7528\u4ee3\u7406\u5bf9\u8c61 \u7531\u8bbf\u95ee\u5b9a\u4e49\u63d0\u4f9b\uff0c\u4ee5\u6267\u884c\u521b\u5efa\u3001\u68c0\u7d22\u3001\u66f4\u65b0\u548c \u5bf9\u6570\u636e\u6267\u884c\u5220\u9664\u64cd\u4f5c\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u7136\u540e\uff0c\u60a8\u7684\u9875\u9762\u4f7f\u7528\u6570\u636e\u8bbf\u95ee\u51fd\u6570\u6765\u54cd\u5e94\u7528\u6237\u4ea4\u4e92\uff0c\u4f8b\u5982 \u8868\u5355\u63d0\u4ea4\u6216\u63a7\u5236\u66f4\u6539\uff0c\u6216\u6267\u884c\u5b9a\u671f\u64cd\u4f5c\u4ee5\u54cd\u5e94\u8ba1\u65f6\u5668\uff0c\u6216 \u4f60\u53ef\u4ee5\u7528 JavaScript \u7f16\u5199\u7684\u5927\u591a\u6570\u5185\u5bb9\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fdc\u7a0b\u7684\u7b80\u5355\u793a\u4f8b \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u8fd9\u4e2a\u7b80\u77ed\u7684\u793a\u4f8b\u6f14\u793a\u4e86\u60a8\u9700\u8981\u5b9e\u73b0\u7684\u4e24\u4e2a\u529f\u80fd \u4f7f\u7528\u8fdc\u7a0b\u5bf9\u8c61\u3002\u6b64 Visualforce \u9875\u9762\u68c0\u7d22\u4e00\u4e2a \u5217\u51fa 10 \u6761\u4ed3\u5e93\u8bb0\u5f55\uff0c\u5e76\u5728\u9875\u9762\u4e0a\u663e\u793a\u5b83\u4eec\u4ee5\u54cd\u5e94\u7528\u6237 \u5355\u51fb<strong>\u3016\u68c0\u7d22\u4ed3\u5e93\u3017<\/strong>\u6309\u94ae\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page&gt;\n    \n    &lt;!-- Remote Objects definition to set accessible sObjects and fields --&gt;\n    &lt;apex:remoteObjects &gt;\n        &lt;apex:remoteObjectModel name=\"Warehouse__c\" jsShorthand=\"Warehouse\" \n            fields=\"Name,Id\"&gt;\n            &lt;apex:remoteObjectField name=\"Phone__c\" jsShorthand=\"Phone\"\/&gt;\n        &lt;\/apex:remoteObjectModel&gt;\n    &lt;\/apex:remoteObjects&gt;\n\n    &lt;!-- JavaScript to make Remote Objects calls --&gt;\n    &lt;script&gt;\n        var fetchWarehouses = function(){\n            \/\/ Create a new Remote Object\n            var wh = new SObjectModel.Warehouse();\n            \n            \/\/ Use the Remote Object to query for 10 warehouse records\n            wh.retrieve({ limit: 10 }, function(err, records, event){\n                if(err) {\n                    alert(err.message);\n                }\n                else {\n                    var ul = document.getElementById(\"warehousesList\");\n                    records.forEach(function(record) {\n                        \/\/ Build the text for a warehouse line item\n                        var whText = record.get(\"Name\");\n                        whText += \" -- \";\n                        whText += record.get(\"Phone\");\n                        \n                        \/\/ Add the line item to the warehouses list\n                        var li = document.createElement(\"li\");\n                        li.appendChild(document.createTextNode(whText));\n                        ul.appendChild(li);\n                    });\n                }\n            });\n        };\n    &lt;\/script&gt;\n\n    &lt;h1&gt;Retrieve Warehouses via Remote Objects&lt;\/h1&gt;\n\n    &lt;p&gt;Warehouses:&lt;\/p&gt;\n\n    &lt;ul id=\"warehousesList\"&gt;\n    &lt;\/ul&gt;\n    &lt;button onclick=\"fetchWarehouses()\"&gt;Retrieve Warehouses&lt;\/button&gt;\n\n&lt;\/apex:page&gt;<\/code><\/pre>\n\n\n\n<p>\u901a\u77e5 \u6b64\u9875\u9762\u6709\u4e9b\u4e0d\u5bfb\u5e38 &#8211; \u6ca1\u6709\u63a7\u5236\u5668\u6216\u63a7\u5236\u5668\u6269\u5c55\u3002 \u6240\u6709\u6570\u636e\u8bbf\u95ee\u5747\u7531\u8fdc\u7a0b\u5904\u7406 \u5bf9\u8c61\u7ec4\u4ef6\u3002\u6b64\u793a\u4f8b\u7684\u7b2c\u4e00\u90e8\u5206\u662f\u8fdc\u7a0b \u5bf9\u8c61\u7ec4\u4ef6\uff0c\u7528\u4e8e\u6307\u5b9a\u8981\u5728 \u9875\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:remoteObjects &gt;\n    &lt;apex:remoteObjectModel name=\"Warehouse__c\" jsShorthand=\"Warehouse\" fields=\"Name,Id\"&gt;\n        &lt;apex:remoteObjectField name=\"Phone__c\" jsShorthand=\"Phone\"\/&gt;\n    &lt;\/apex:remoteObjectModel&gt;\n&lt;\/apex:remoteObjects&gt;<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e9b \u7ec4\u4ef6\u751f\u6210 JavaScript \u6a21\u578b\u7c7b\uff0c\u8bbf\u95ee\u4e2d\u7684\u6bcf\u4e2a sObject \u4e00\u4e2a \u89c4\u8303\uff0c\u7528\u4e8e\u76f4\u63a5\u4ece JavaScript \u8fdb\u884c\u6570\u636e\u8bbf\u95ee\u8c03\u7528 \u6cd5\u5178\u3002\u8bf7\u6ce8\u610f\u8be5\u5c5e\u6027\u7684\u4f7f\u7528\uff0c\u8be5\u5c5e\u6027\u5c06\u5b8c\u6574\u7684 Salesforce API \u540d\u79f0\u6620\u5c04\u5230 \u5728 JavaScript \u4ee3\u7801\u4e2d\u4f7f\u7528\u7684\u66f4\u7b80\u5355\u3001\u66f4\u77ed\u7684\u540d\u79f0\u3002\u5982\u679c\u60a8\u6253\u7b97\u6253\u5305\u548c \u5206\u53d1\u4ee3\u7801\uff0c\u8bbe\u7f6e\u4e3a \u5fc5\u4e0d\u53ef\u5c11\uff0c\u56e0\u4e3a\u5b83\u6d88\u9664\u4e86\u5728 \u6253\u5305\u7684\u4ee3\u7801\u3002\u4f7f\u7528\u901f\u8bb0\u53ef\u4ee5\u5b8c\u6210\u6240\u6709\u5de5\u4f5c\u3002<\/p>\n\n\n\n<p><samp>jsShorthand<\/samp><samp>jsShorthand<\/samp>\u6b64\u793a\u4f8b\u7684\u7b2c\u4e8c\u90e8\u5206\u662f\u4e00\u4e2a JavaScript \u51fd\u6570\uff0c\u8be5\u51fd\u6570\u4f7f\u7528\u4ee5\u4e0b\u6a21\u578b \u7531\u8bbf\u95ee\u5b9a\u4e49\u7ec4\u4ef6\u751f\u6210\uff0c\u7528\u4e8e\u68c0\u7d22\u4e00\u7ec4\u8981\u663e\u793a\u7684\u8bb0\u5f55 \u5728 \u9875\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!-- JavaScript to make Remote Objects calls --&gt;\n&lt;script&gt;\n    var fetchWarehouses = function(){\n        \/\/ Create a new Remote Object\n        var wh = new SObjectModel.Warehouse();\n        \n        \/\/ Use the Remote Object to query for 10 warehouse records\n        wh.retrieve({ limit: 10 }, function(err, records, event){\n            if(err) {\n                alert(err.message);\n            }\n            else {\n                var ul = document.getElementById(\"warehousesList\");\n                records.forEach(function(record) {\n                    \/\/ Build the text for a warehouse line item\n                    var whText = record.get(\"Name\");\n                    whText += \" -- \";\n                    whText += record.get(\"Phone\");\n                    \n                    \/\/ Add the line item to the warehouses list\n                    var li = document.createElement(\"li\");\n                    li.appendChild(document.createTextNode(whText));\n                    ul.appendChild(li);\n                });\n            }\n        });\n    };\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p>\u8fd9 \u51fd\u6570\u7684\u7b2c\u4e00\u884c\u4ece\u6a21\u578b\u521b\u5efa\u4e00\u4e2a Warehouse \u5bf9\u8c61\u3002\u8bf7\u6ce8\u610f\uff0c \u521b\u5efa\u5b83\u7684\u8c03\u7528\u4f7f\u7528 for sObject \u800c\u4e0d\u662f\u5bf9\u8c61\u7684\u5b8c\u6574 API \u540d\u79f0\u3002\u9075\u5faa\u6b64\u6700\u4f73\u5b9e\u8df5 \u5c06 JavaScript \u4ee3\u7801\u4e0e\u7ec4\u7ec7\u547d\u540d\u7a7a\u95f4\u7684\u7ec6\u8282\u5206\u79bb\uff0c sObject \u548c\u5b57\u6bb5\u540d\u79f0\u7b49\uff0c\u5e76\u4f7f\u4ee3\u7801\u66f4\u52a0\u7b80\u6d01\u660e\u4e86\u3002<\/p>\n\n\n\n<p><samp>jsShorthand<\/samp><\/p>\n\n\n\n<p>\u7b2c\u4e8c\u884c\u4f7f\u7528\u65b0\u7684 Warehouse \u5bf9\u8c61 \u6765\u6267\u884c\u5bf9 Warehouse \u8bb0\u5f55\u7684\u67e5\u8be2\u3002\u8be5\u8c03\u7528\u63d0\u4f9b\u4e24\u4e2a \u53c2\u6570\uff1a\u4e00\u4e2a\u7b80\u5355\u7684\u67e5\u8be2\u8bf4\u660e\u7b26\u548c\u4e00\u4e2a\u7528\u4e8e\u5904\u7406\u7ed3\u679c\u7684\u533f\u540d\u51fd\u6570\u3002\u8fd9 \u51fd\u6570\u662f\u6807\u51c6\u7684 JavaScript\u3002\u5b83\u5faa\u73af\u8bbf\u95ee\u7ed3\u679c\u5e76\u521b\u5efa\u5217\u8868\u9879\u4ee5 \u8ffd\u52a0\u5230\u9875\u9762\u4e0a\u7684\u4ed3\u5e93\u5217\u8868\u3002<samp>wh<\/samp>\u9875\u9762\u6b63\u6587\u662f\u9759\u6001\u7684 HTML\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;h1&gt;Retrieve Warehouses via Remote Objects&lt;\/h1&gt;\n\n&lt;p&gt;Warehouses:&lt;\/p&gt;\n\n&lt;ul id=\"warehousesList\"&gt;\n&lt;\/ul&gt;\n&lt;button onclick=\"fetchWarehouses()\"&gt;Retrieve Warehouses&lt;\/button&gt;<\/code><\/pre>\n\n\n\n<p>\u4f60 \u4ee3\u7801\u5c06\u7ed3\u679c\u6dfb\u52a0\u5230\u5217\u8868\u4e2d\u3002 \u52a0\u8f7d\u9875\u9762\u65f6\uff0c\u5217\u8868\u4e3a\u7a7a\u3002\u5355\u51fb\u8be5\u6309\u94ae\u5c06\u89e6\u53d1 JavaScript \u4e4b\u524d\u5b9a\u4e49\u7684\u51fd\u6570\uff0c\u7528\u4e8e\u6267\u884c\u67e5\u8be2\u5e76\u6dfb\u52a0\u7ed3\u679c\u3002<\/p>\n\n\n\n<p><samp>warehousesList<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u8fdc\u7a0b JavaScript \u4e2d\u7684\u5bf9\u8c61<\/h2>\n\n\n\n<p>\u8fdc\u7a0b\u751f\u6210\u7684 JavaScript \u6a21\u578b \u5bf9\u8c61\u7ec4\u4ef6\u63d0\u4f9b\u4e86\u4e00\u4e2a JavaScript API\uff0c\u7528\u4e8e\u4e3a\u5e94\u7528\u521b\u5efa\u8bfb\u53d6\u548c\u4fdd\u5b58\u7684\u51fd\u6570 \u503c\u8fd4\u56de\u7ed9 Salesforce\u3002\u4f7f\u7528\u7ec4\u4ef6\u521b\u5efa\u7684\u57fa\u672c\u6a21\u578b\u8fdb\u884c\u5b9e\u4f8b\u5316 \u76f8\u5e94 sObject \u7684\u7279\u5b9a\u6a21\u578b\u3002\u7136\u540e\u4f7f\u7528\u7279\u5b9a\u6a21\u578b\u6267\u884c\u64cd\u4f5c \u5728\u4ed6\u4eec\u7684 sObject \u4e0a\uff0c\u4f8b\u5982\u68c0\u7d22\u3001\u521b\u5efa\u3001\u66f4\u65b0\u548c\u5220\u9664\u3002<\/p>\n\n\n\n<p><samp>&lt;apex:remoteObjects><\/samp>\u8fdc\u7a0b\u7684\u57fa\u672c\u578b\u53f7 \u5bf9\u8c61\u7531\u7ec4\u4ef6\u521b\u5efa\u3002\u57fa\u672c\u6a21\u578b\u4e3a Remote \u63d0\u4f9b\u4e86\u4e00\u4e2a\u4f2a\u547d\u540d\u7a7a\u95f4 \u4f7f\u7528\u5b83\u521b\u5efa\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u57fa\u672c\u6a21\u578b\u662f \u547d\u540d\u7684\uff0c\u4f46\u60a8\u53ef\u4ee5\u4f7f\u7528\u8be5\u5c5e\u6027\u6765\u8bbe\u7f6e\u540d\u79f0\u3002\u4f7f\u7528\u4e0d\u540c\u7684\u5e95\u5ea7 \u5bf9\u76f8\u5173\u8fdc\u7a0b\u8fdb\u884c\u5206\u7ec4\u7684\u6a21\u578b \u6cbf\u529f\u80fd\u7ebf\u6216\u5305\u88c5\u7ebf\u7684\u5bf9\u8c61\u3002\u4e3a \u4f8b\uff1a<\/p>\n\n\n\n<p><samp>&lt;apex:remoteObjects&gt;<\/samp><samp>SObjectModel<\/samp><samp>jsNamespace<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:remoteObjects jsNamespace=\"MyCorpModels\"&gt;\n    &lt;apex:remoteObjectModel name=\"Contact\" fields=\"FirstName,LastName\"\/&gt;\n&lt;\/apex:remoteObjects&gt;\n&lt;apex:remoteObjects jsNamespace=\"TrackerModels\"&gt;\n    &lt;apex:remoteObjectModel name=\"Shipment__c\" fields=\"Id,TrackNum__c\"\/&gt;\n&lt;\/apex:remoteObjects&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u7279\u5b9a\u578b\u53f7<\/h2>\n\n\n\n<p>\u60a8\u901a\u5e38\u4e0d\u4f1a\u81ea\u5df1\u521b\u5efa\u57fa\u7840\u6a21\u578b\uff0c\u800c\u662f\u4f7f\u7528\u751f\u6210\u7684 \u57fa\u7840\u6a21\u578b\u4f5c\u4e3a\u521b\u5efa\u7279\u5b9a\u6a21\u578b\u7684\u5de5\u5382\u3002\u4f8b\u5982\uff0c\u4f7f\u7528\u4e0a\u9762\u7684 \u58f0\u660e\uff0c\u5728 JavaScript \u4e2d\u5b9e\u4f8b\u5316\u4e00\u4e2a Contact \u6a21\u578b\uff0c\u4f8b\u5982 \u8fd9\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ct = new MyCorpModels.Contact();<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f \u8fd9\u662f\u4e00\u4e2a JavaScript \u6a21\u578b \u8054\u7cfb\u4eba\u5bf9\u8c61\uff0c\u800c\u4e0d\u662f\u7279\u5b9a\u7684\u8054\u7cfb\u4eba\u8bb0\u5f55\u3002<\/p>\n\n\n\n<p><samp>ct<\/samp><\/p>\n\n\n\n<p><samp>ct<\/samp>\u8868\u793a\u4e00\u4e2a\u7279\u5b9a\u7684\u5bf9\u8c61\uff0c\u5e76\u63d0\u4f9b \u9875\u9762\u7684 JavaScript \u548c Salesforce \u670d\u52a1\u3002 \u53ef\u7528\u4e8e\u6267\u884c\u57fa\u672c\u7684\u201cCRUD\u201d \u5bf9 Contact \u5bf9\u8c61\u6267\u884c\u7684\u64cd\u4f5c\uff08\u521b\u5efa\u3001\u8bfb\u53d6\u3001\u66f4\u65b0\u548c\u5220\u9664\uff09\u5728 \u6570\u636e\u5e93\u3002<samp>Contact<\/samp><samp>ct<\/samp>\u5728\u4ee5\u4e0b\u5404\u8282\u4e2d\uff0c\u793a\u4f8b\u57fa\u4e8e\u4ee5\u4e0b\u8fdc\u7a0b \u5bf9\u8c61\u58f0\u660e\uff0c\u5b83\u4f7f\u7528\u6240\u6709\u4e09\u4e2a Remote \u5bf9\u8c61\u7ec4\u4ef6\uff0c\u5e76\u6f14\u793a\u5982\u4f55\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5b57\u6bb5\u3001Notes__c\u3001 \u5e26\u6709\u201c\u7b80\u5199\u201d\u540d\u79f0\uff0c\u4ee5\u4fbf\u5728 JavaScript \u4e2d\u8bbf\u95ee\u5b83 \u81ea\u7136\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:remoteObjects jsNamespace=\"RemoteObjectModel\"&gt;\n    &lt;apex:remoteObjectModel name=\"Contact\" fields=\"Id,FirstName,LastName,Phone\"&gt;\n        &lt;apex:remoteObjectField name=\"Notes__c\" jsShorthand=\"Notes\"\/&gt;\n    &lt;\/apex:remoteObjectModel&gt;\n&lt;\/apex:remoteObjects&gt;<\/code><\/pre>\n\n\n\n<p>\u8fd9 \u58f0\u660e\u4f7f\u60a8\u80fd\u591f\u8bbf\u95ee\u8054\u7cfb\u4eba\u8bb0\u5f55\u4e0a\u7684\u4e94\u4e2a\u5b57\u6bb5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b9e\u4f8b\u5316\u6a21\u578b\u548c\u8bbf\u95ee\u5b57\u6bb5<\/h2>\n\n\n\n<p>\u5b9e\u4f8b\u5316\u8bbe\u7f6e\u4e86\u6216\u672a\u8bbe\u7f6e\u5b57\u6bb5\u503c\u7684\u6a21\u578b\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u7684\u610f\u56fe\u3002 \u901a\u5e38\uff0c\u5f53\u60a8\u60f3\u8981\u5c06\u66f4\u6539\u5199\u5165\u6570\u636e\u5e93\u65f6\uff0c\u60a8\u5c06\u8bbe\u7f6e\u5b57\u6bb5 \u5e76\u5728\u60a8\u53ea\u662f\u9605\u8bfb\u65f6\u7701\u7565\u5b57\u6bb5\u3002\u5b57\u6bb5\u503c\u662f\u901a\u8fc7\u4f20\u5165\u6765\u8bbe\u7f6e\u7684 \u4e00\u4e2a JSON \u5b57\u7b26\u4e32\uff0c\u5176\u4e2d\u5305\u542b\u8981\u5728\u65b0\u6a21\u578b\u4e0a\u8bbe\u7f6e\u7684\u5b57\u6bb5\u7684\u503c\u3002\u82e5\u8981\u521b\u5efa\u672a\u8bbe\u7f6e\u5b57\u6bb5\u7684\u6a21\u578b\uff0c\u8bf7\u4f7f\u7528\u7a7a\u53c2\u6570\u521b\u5efa\u8be5\u6a21\u578b \u5217\u8868\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ct = new RemoteObjectModel.Contact();<\/code><\/pre>\n\n\n\n<p>\u8981\u5b9e\u4f8b\u5316\u8bbe\u7f6e\u4e86\u5b57\u6bb5\u7684\u6a21\u578b\uff0c\u901a\u5e38\u8981\u521b\u5efa\u65b0\u8bb0\u5f55\uff0c\u8bf7\u4f20\u5165 \u5305\u542b\u5b57\u6bb5\u540d\u79f0\u548c\u503c\u5bf9\u7684\u5bf9\u8c61\u3002\u4e3a \u4f8b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ct = new RemoteObjectModel.Contact({ \n    FirstName: \"Aldo\",\n    LastName: \"Michaels\", \n    Phone: \"(415) 555-1212\"\n});<\/code><\/pre>\n\n\n\n<p>\u8fdc\u7a0b \u5bf9\u8c61\u6a21\u578b\u4f7f\u7528\u57fa\u672c \u548c \u65b9\u6cd5\u6765\u68c0\u7d22\u548c\u8bbe\u7f6e\u5b57\u6bb5\u503c\u3002 \u4e3a \u4f8b\uff1a<\/p>\n\n\n\n<p><samp>get()<\/samp><samp>set()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ct = new RemoteObjectModel.Contact({ FirstName: \"Aldo\" });\nct.get('FirstName');  \/\/ 'Aldo'\nct.get('Phone'); \/\/ &lt;undefined&gt;\nct.set('FirstName', 'Benedict');\nct.set('Phone', '(415) 555-1212');<\/code><\/pre>\n\n\n\n<p>\u6709 \u4f7f\u7528\u5c5e\u6027\u5217\u8868\u4e2d\u7684\u5c5e\u6027\u5217\u8868\u8bbe\u7f6e\u5b57\u6bb5\u503c\u4e4b\u95f4\u6ca1\u6709\u529f\u80fd\u5dee\u5f02 \u6784\u9020\u51fd\u6570\u5e76\u4f7f\u7528 \u8bbe\u7f6e\u5b57\u6bb5\u503c\u3002<\/p>\n\n\n\n<p><samp>set()<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528 Remote \u521b\u5efa\u8bb0\u5f55 \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u901a\u8fc7\u8c03\u7528 Remote \u521b\u5efa\u8bb0\u5f55 \u5bf9\u8c61\u6a21\u578b\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<p><samp>create()<\/samp><\/p>\n\n\n\n<p><samp>create()<\/samp>\u63a5\u53d7\u4e24\u4e2a \u53c2\u6570\uff0c\u4e24\u8005\u90fd\u662f\u53ef\u9009\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RemoteObjectModel.create({<em>field_values<\/em>}, <em>callback_function<\/em>)<\/code><\/pre>\n\n\n\n<p>\u5757 \u4f7f\u60a8\u80fd\u591f\u5728\u4e00\u4e2a\u8bed\u53e5\u4e2d\u5b9a\u4e49\u548c\u521b\u5efa\u8bb0\u5f55\u3002\u8bbe\u7f6e\u5b57\u6bb5 \u503c\uff0c\u5c31\u50cf\u4f7f\u7528 JSON \u5b57\u7b26\u4e32\u521b\u5efa\u6a21\u578b\u65f6\u4e00\u6837\u3002\u4e3a \u4f8b\u5982\uff0c\u4ee5\u4e0b\u4e24\u4e2a\u8c03\u7528\u662f\u7b49\u6548\u7684\u3002<\/p>\n\n\n\n<p><samp>field_values<\/samp><samp>create()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ctDetails = { FirstName: 'Marc', LastName: 'Benioff' };\n\n\/\/ Call create() on an existing Contact model, with no arguments\nvar ct = new RemoteObjectModel.Contact(ctDetails);\nct.create();\n\n\/\/ Call create() on an empty Contact model, passing in field values\nvar ct = new RemoteObjectModel.Contact();\nct.create(ctDetails);<\/code><\/pre>\n\n\n\n<p><samp>create()<\/samp>\u4e0d \u76f4\u63a5\u8fd4\u56de\u7ed3\u679c\u3002\u56de\u8c03\u51fd\u6570\u4f7f\u60a8\u80fd\u591f\u5904\u7406 \u5f02\u6b65\u670d\u52a1\u5668\u54cd\u5e94\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u6240\u6709\u670d\u52a1\u5668\u64cd\u4f5c \u4f7f\u7528\u8fdc\u7a0b \u5bf9\u8c61\u662f\u5f02\u6b65\u6267\u884c\u7684\u3002\u4efb\u4f55\u4f9d\u8d56\u4e8e \u6b63\u5728\u5b8c\u6210\u7684\u8bf7\u6c42\uff08\u5305\u62ec\u5904\u7406\u8fd4\u56de\u7684\u7ed3\u679c\uff09\u5fc5\u987b \u653e\u7f6e\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u3002\u4f60\u7684\u56de\u8c03\u51fd\u6570 \u6700\u591a\u53ef\u4ee5\u63a5\u53d7\u4e09\u4e2a\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function <em>callback<\/em>(Error <em>error<\/em>, Array <em>results<\/em>, Object <em>event<\/em>) { \/\/ ... }<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u8fdc\u7a0b \u5bf9\u8c61\u56de\u8c03\u51fd\u6570\uff0c\u4e86\u89e3\u6709\u5173\u7f16\u5199 Remote \u7684\u8be6\u7ec6\u4fe1\u606f \u5bf9\u8c61\u56de\u8c03\u51fd\u6570\u3002\u8be5\u5b57\u6bb5\u5df2\u8bbe\u7f6e\u4e3a \u8fdc\u7a0b\u5bf9\u8c61\u4f5c\u4e3a\u6210\u529f\u8c03\u7528\u7684\u4e00\u90e8\u5206\u3002\u60a8\u53ef\u4ee5\u8bbf\u95ee\u6b64 \u5b57\u6bb5\u3002<\/p>\n\n\n\n<p><samp>Id<\/samp><samp>create()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ctDetails = { FirstName: 'Marc', LastName: 'Benioff' };\nvar ct = new RemoteObjectModel.Contact();\nct.create(ctDetails, function(err) {\n    if(err) { \n        console.log(err);\n        alert(err.message);\n    }\n    else {\n        \/\/ this is the contact\n        console.log(ct.log());     \/\/ Dump contact to log\n        console.log(ct.get('Id')); \/\/ Id is set when create completes\n    }\n});<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f\u8be5\u51fd\u6570\u7684\u4f7f\u7528;\u5b83\u76f8\u5f53\u4e8e Remote \u5bf9\u8c61\u3002<\/p>\n\n\n\n<p><samp>log()<\/samp><samp>toString()<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u8fdc\u7a0b\u68c0\u7d22\u8bb0\u5f55 \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u901a\u8fc7\u8c03\u7528\u8fdc\u7a0b\u6765\u68c0\u7d22\u8bb0\u5f55 \u5bf9\u8c61\u6a21\u578b\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<p><samp>retrieve()<\/samp><\/p>\n\n\n\n<p><samp>retrieve()<\/samp>\u9700\u8981\u4e24\u4e2a\u53c2\u6570\uff0c\u4e00\u4e2a\u7528\u4e8e\u67e5\u8be2 \u6761\u4ef6\uff0c\u4e00\u4e2a\u7528\u4e8e\u56de\u8c03 \u5904\u7406\u5668\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RemoteObjectModel.retrieve({<em>criteria<\/em>}, <em>callback_function<\/em>)<\/code><\/pre>\n\n\n\n<p><samp>criteria<\/samp>\u53ef\u4ee5\u662f\u8fdc\u7a0b\u5bf9\u8c61\u67e5\u8be2\u5bf9\u8c61\u6216\u8fd4\u56de\u5bf9\u8c61\u7684\u51fd\u6570\u3002\u4ee5\u4e0b\u4e24\u4e2a\u8c03\u7528\u662f \u7b49\u6548\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ct = new RemoteObjectModel();\n\n\/\/ Empty callback functions for simplicity\nct.retrieve({where: {FirstName: {eq: 'Marc' }}}, function() {}); \/\/ query object\n\nct.retrieve(function(){\n\treturn({where: {FirstName: {eq: 'Marc' }}});\n}, function() {}); \/\/ function returning query object<\/code><\/pre>\n\n\n\n<p>\u8bf7\u53c2\u9605\u8fdc\u7a0b\u7684\u683c\u5f0f\u548c\u9009\u9879\u00a0\u5bf9\u8c61\u67e5\u8be2\u6761\u4ef6\uff0c\u7528\u4e8e\u67e5\u8be2\u5bf9\u8c61\u7684\u8bf4\u660e\u3002<\/p>\n\n\n\n<p><samp>retrieve()<\/samp>\u4e0d\u8fd4\u56de\u7ed3\u679c \u5f84\u76f4\u3002\u56de\u8c03\u51fd\u6570\u4f7f\u60a8\u80fd\u591f\u5904\u7406\u670d\u52a1\u5668\u54cd\u5e94 \u5f02\u6b65\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u6240\u6709\u670d\u52a1\u5668\u64cd\u4f5c \u4f7f\u7528\u8fdc\u7a0b \u5bf9\u8c61\u662f\u5f02\u6b65\u6267\u884c\u7684\u3002\u4efb\u4f55\u4f9d\u8d56\u4e8e \u6b63\u5728\u5b8c\u6210\u7684\u8bf7\u6c42\uff08\u5305\u62ec\u5904\u7406\u8fd4\u56de\u7684\u7ed3\u679c\uff09\u5fc5\u987b \u653e\u7f6e\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u3002\u4f60\u7684\u56de\u8c03\u51fd\u6570 \u6700\u591a\u53ef\u4ee5\u63a5\u53d7\u4e09\u4e2a\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function <em>callback<\/em>(Error <em>error<\/em>, Array <em>results<\/em>, Object <em>event<\/em>) { \/\/ ... }<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u8fdc\u7a0b \u5bf9\u8c61\u56de\u8c03\u51fd\u6570\uff0c\u4e86\u89e3\u6709\u5173\u7f16\u5199 Remote \u7684\u8be6\u7ec6\u4fe1\u606f \u5bf9\u8c61\u56de\u8c03\u51fd\u6570\u3002<\/p>\n\n\n\n<p>\u82e5\u8981\u4f7f\u7528\u65e5\u671f\u68c0\u7d22\u8bb0\u5f55\uff0c\u8bf7\u5c06 JavaScript date \u5bf9\u8c61\u4f20\u5165\u67e5\u8be2\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var myDate = new Date('2017-01-20');\nct.retrieve({where: {CloseDate: {eq: myDate}}}, function() {});<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u8fdc\u7a0b\u66f4\u65b0\u8bb0\u5f55 \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u901a\u8fc7\u8c03\u7528\u8fdc\u7a0b\u6765\u66f4\u65b0\u8bb0\u5f55 \u5bf9\u8c61\u6a21\u578b\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<p><samp>update()<\/samp><\/p>\n\n\n\n<p><samp>update()<\/samp>\u63a5\u53d7\u4e09\u4e2a \u53c2\u6570\uff0c\u90fd\u662f\u53ef\u9009\u7684\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728 \u540c\u65f6\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e\u60a8\u63d0\u4f9b\u7684\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RemoteObjectModel.update(&#91;<em>record_ids<\/em>], {<em>field_values<\/em>}, <em>callback_function<\/em>)<\/code><\/pre>\n\n\n\n<p><samp>record_ids<\/samp>\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u5176\u4e2d\u5b57\u7b26\u4e32\u662f \u8981\u66f4\u65b0\u7684\u8bb0\u5f55\u6570\u3002\u5982\u679c\u8fd9 \u53c2\u6570\uff0c\u5219\u5728 \u4f7f\u7528\u8fdc\u7a0b\u5bf9\u8c61\u5b9e\u4f8b\u3002\u66f4\u65b0\u8bb0\u5f55\u7684\u6700\u7b80\u5355\u65b9\u6cd5\u662f\u8c03\u7528 \u672c\u8eab\u3002<\/p>\n\n\n\n<p><samp>Id<\/samp><samp>Id<\/samp><samp>update()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctDetails = {FirstName: \"Marc\", LastName: \"Benioff\"};\nct = new RemoteObjectModel.Contact(ctDetails);\nct.create();\n\n\/\/ Later, in response to a page event...\nct.set('Phone', '555-1212');\nct.update();<\/code><\/pre>\n\n\n\n<p>\u66f4\u5e38\u89c1\u7684\u662f\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u66f4\u65b0\u8bb0\u5f55\u4ee5\u54cd\u5e94\u8868\u5355\u63d0\u4ea4\u3002\u66f4\u65b0 \u8bb0\u5f55\u53ef\u4ee5\u50cf\u8bfb\u53d6\u4e00\u4e9b\u8868\u5355\u503c\u4e00\u6837\u7b80\u5355\uff0c\u5305\u62ec\u8bb0\u5f55\u7684 \uff0c\u5e76\u5c06\u8fd9\u4e9b\u503c\u4f20\u9012\u7ed9 \u3002\u4e3a \u4f8b\uff1a<\/p>\n\n\n\n<p><samp>Id<\/samp><samp>update()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var record = new RemoteObjectModel.Contact();\nrecord.update($j('#contactId').val(),\n{\n    FirstName: $j('#fName').val(),\n    LastName: $j('#lName').val(),\n    Phone: $j('#phone').val(),\n    Notes: $j('#notes').val() \n});<\/code><\/pre>\n\n\n\n<p>\u53ef\u9760\u7684\u4ee3\u7801\u5305\u62ec\u7528\u4e8e\u5904\u7406\u9519\u8bef\u7684\u56de\u8c03\u3002\u4ee5\u4e0b \u4ee3\u7801\u7684\u5b8c\u6210\u65b9\u5f0f\u4e0e\u4e0a\u4e00\u4e2a\u793a\u4f8b\u76f8\u540c\uff0c\u4f46\u5df2\u66f4\u6539\u4e3a\u4f7f\u7528 \u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u548c\u56de\u8c03\u51fd\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Handle the Save button\nfunction updateContact(e){\n    e.preventDefault();\n\n    var record = new RemoteObjectModel.Contact({\n        Id: $jQuery('#contactId').val(),\n        FirstName: $jQuery('#fName').val(),\n        LastName: $jQuery('#lName').val(),\n        Phone: $jQuery('#phone').val(),\n        Notes: $jQuery('#notes').val() \n    });\n    record.update(updateCallback);\n}\n\n\/\/ Callback to handle DML Remote Objects calls\nfunction updateCallback(err, ids){\n    if (err) { \n        displayError(err); \n    } else {\n        \/\/ Reload the contacts with current list\n        getAllContacts();\n        $jQuery.mobile.changePage('#listpage', {changeHash: true});\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u60a8\u53ef\u4ee5\u540c\u65f6\u66f4\u65b0\u591a\u6761\u8bb0\u5f55\uff0c\u53ea\u8981\u66f4\u65b0 \u8981\u6267\u884c\u7684\u662f\u7edf\u4e00\u7684\uff0c\u5373\u6bcf\u6761\u8bb0\u5f55\u90fd\u76f8\u540c\u3002\u4e3a \u4f8b\u5982\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u4ece \u5217\u8868\uff0c\u5c06\u72b6\u6001\u5b57\u6bb5\u66f4\u6539\u4e3a\u201c\u5df2\u5b58\u6863\u201d\u6216 \u5f53\u524d\u65f6\u95f4\u6233\u3002\u82e5\u8981\u66f4\u65b0\u4e00\u4e2a\u8bf7\u6c42\u4e2d\u7684\u8bb0\u5f55\uff0c\u8bf7\u4f20\u9012\u6570\u7ec4 \u7684 s \u5230 .\u8981\u66f4\u65b0\u7684\u5b57\u6bb5 \u53ef\u4ee5\u8bbe\u7f6e\u4e3a\u8fdc\u7a0b\u5bf9\u8c61\u6a21\u578b\u672c\u8eab\u7684\u4e00\u90e8\u5206\uff0c\u4f46\u5b83\u662f \u5c06\u5b83\u4eec\u76f4\u63a5\u4f20\u9012\u7ed9 \u66f4\u5b89\u5168\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<p><samp>Id<\/samp><samp>update()<\/samp><samp>update()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ct = new RemoteObjectModel.Contact();\nct.update(\n    &#91;'003xxxxxxxxxxxxxxx', '003xxxxxxxxxxxxxxx'], \n    { FirstName: \"George\", LastName: \"Foreman\" },\n    function(err, ids) {\n        if (err) { \n            displayError(err); \n        } else {\n            \/\/ Reload the contacts with current list\n            getAllContacts();\n            $jQuery('#status').html(ids.length + ' record(s) updated.');\n            $jQuery.mobile.changePage('#listpage', {changeHash: true});\n        }\n});<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u5f53\u60a8\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u66f4\u65b0\u591a\u6761\u8bb0\u5f55\u65f6\uff0c\u6240\u6709 \u7684\u8bb0\u5f55\u5728\u540c\u4e00\u670d\u52a1\u5668\u7aef\u4e8b\u52a1\u4e2d\u66f4\u65b0\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u8fdc\u7a0b\u66f4\u65b0\u63d2\u5165\u8bb0\u5f55 \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u901a\u8fc7\u8c03\u7528\u8fdc\u7a0b\u6765\u4fdd\u5b58\u8bb0\u5f55 \u5bf9\u8c61\u6a21\u578b\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<p><samp>upsert()<\/samp><\/p>\n\n\n\n<p><samp>upsert()<\/samp>\u662f\u4e00\u79cd\u4fbf\u5229 \u51fd\u6570\uff0c\u5982\u679c\u8bb0\u5f55\u5b58\u5728\uff0c\u5219\u66f4\u65b0\u8bb0\u5f55\uff0c\u5982\u679c\u4e0d\u5b58\u5728\uff0c\u5219\u521b\u5efa\u8bb0\u5f55\u3002 \u5728\u5e55\u540e\u59d4\u6258\u7ed9 \u6216 .\u7528\u4e8e\u4e3a \u4e0d\u53d7\u8bb0\u5f55\u5f71\u54cd\u7684\u9875\u9762\u6216\u5e94\u7528\u7a0b\u5e8f \u6765\u81ea\u65b0\u7684\u8f93\u5165\u8868\u5355\u6216\u7f16\u8f91\u8bb0\u5f55\u9875\u9762\u3002<samp>upsert()<\/samp><samp>create()<\/samp><samp>update()<\/samp><samp>upsert()<\/samp><\/p>\n\n\n\n<p><samp>upsert()<\/samp>\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff0c \u4e24\u8005\u90fd\u662f\u53ef\u9009\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RemoteObjectModel.upsert({<em>field_values<\/em>}, <em>callback_function<\/em>)<\/code><\/pre>\n\n\n\n<p>\u5757 \u4f7f\u60a8\u80fd\u591f\u8bbe\u7f6e\u503c\u5e76\u5c06\u8bb0\u5f55\u4fdd\u5b58\u5728\u4e00\u4e2a\u8bed\u53e5\u4e2d\u3002 \u50cf\u521b\u5efa\u6a21\u578b\u65f6\u4e00\u6837\uff0c\u4f7f\u7528 JSON \u5b57\u7b26\u4e32\u8bbe\u7f6e\u5b57\u6bb5\u503c\u3002 \u4f8b\u5982\uff0c\u4ee5\u4e0b\u4e24\u4e2a\u8c03\u7528\u662f\u7b49\u6548\u7684\u3002<\/p>\n\n\n\n<p><samp>field_values<\/samp><samp>upsert()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Call upsert() on a Contact model, with no arguments\n\/\/ ct is a RemoteObjectModel.Contact that already has data\nct.set('Phone', '(415) 777-1212');\nct.upsert();\n\n\/\/ Call upsert() on a Contact model, passing in field values\n\/\/ ct is a RemoteObjectModel.Contact that already has data\nct.upsert({Phone: '(415) 777-1212'});<\/code><\/pre>\n\n\n\n<p>\u5728\u524d\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u4e0d\u6e05\u695a\u8054\u7cfb\u4eba\u662f\u5426 \u5b58\u5728\u4e8e\u6570\u636e\u5e93\u4e2d\uff0c\u6216\u8005\u5982\u679c\u5b83\u662f\u65b0\u8054\u7cfb\u4eba\uff0c\u5219 \u6765\u81ea\u8f93\u5165\u8868\u5355\u3002 \u5904\u7406\u7ec6\u8282\u3002\u5982\u679c\u5728\u8054\u7cfb\u4eba\u4e0a\u8bbe\u7f6e\u4e86\u5b57\u6bb5\uff0c\u5219 \u8054\u7cfb\u65b9\u5f0f\u5c06\u66f4\u65b0\u3002\u5982\u679c\u6ca1\u6709\uff0c\u5219\u521b\u5efa\u4e00\u4e2a\u65b0\u8054\u7cfb\u4eba\u3002<samp>upsert()<\/samp><samp>Id<\/samp><samp>Id<\/samp><\/p>\n\n\n\n<p><samp>upsert()<\/samp>\u4e0d \u76f4\u63a5\u8fd4\u56de\u7ed3\u679c\u3002\u56de\u8c03\u51fd\u6570\u4f7f\u60a8\u80fd\u591f\u5904\u7406 \u5f02\u6b65\u670d\u52a1\u5668\u54cd\u5e94\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u6240\u6709\u670d\u52a1\u5668\u64cd\u4f5c \u4f7f\u7528\u8fdc\u7a0b \u5bf9\u8c61\u662f\u5f02\u6b65\u6267\u884c\u7684\u3002\u4efb\u4f55\u4f9d\u8d56\u4e8e \u6b63\u5728\u5b8c\u6210\u7684\u8bf7\u6c42\uff08\u5305\u62ec\u5904\u7406\u8fd4\u56de\u7684\u7ed3\u679c\uff09\u5fc5\u987b \u653e\u7f6e\u5728\u56de\u8c03\u51fd\u6570\u4e2d\u3002\u4f60\u7684\u56de\u8c03\u51fd\u6570 \u6700\u591a\u53ef\u4ee5\u63a5\u53d7\u4e09\u4e2a\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function <em>callback<\/em>(Error <em>error<\/em>, Array <em>results<\/em>, Object <em>event<\/em>) { \/\/ ... }<\/code><\/pre>\n\n\n\n<p>\u67e5\u770b\u8fdc\u7a0b \u5bf9\u8c61\u56de\u8c03\u51fd\u6570\uff0c\u4e86\u89e3\u6709\u5173\u7f16\u5199 Remote \u7684\u8be6\u7ec6\u4fe1\u606f \u5bf9\u8c61\u56de\u8c03\u51fd\u6570\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528 Remote \u5220\u9664\u8bb0\u5f55 \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u901a\u8fc7\u8c03\u7528\u8fdc\u7a0b\u5220\u9664\u8bb0\u5f55 \u5bf9\u8c61\u6a21\u578b\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<p><samp>del()<\/samp><\/p>\n\n\n\n<p><samp>del()<\/samp>\u63a5\u53d7\u4e24\u4e2a\u53c2\u6570\uff0c \u4e24\u8005\u90fd\u662f\u53ef\u9009\u7684\uff0c\u5e76\u4e14\u53ef\u4ee5\u5220\u9664\u4e00\u6761\u6216\u591a\u6761\u8bb0\u5f55\uff0c\u5177\u4f53\u53d6\u51b3\u4e8e \u60a8\u63d0\u4f9b\u7684\u53c2\u6570\u3002<\/p>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u4e3a\u4ec0\u4e48\u4ee3\u66ff \uff1f \u662f\u4fdd\u7559\u5b57 \u5728 JavaScript \u4e2d\u3002<samp>del()<\/samp><samp>delete()<\/samp><samp>delete<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>RemoteObjectModel.del(&#91;<em>record_ids<\/em>], <em>callback_function<\/em>)<\/code><\/pre>\n\n\n\n<p><samp>record_ids<\/samp>\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32\u6570\u7ec4\uff0c\u5176\u4e2d\u5b57\u7b26\u4e32\u662f \u8981\u5220\u9664\u7684\u8bb0\u5f55\u7684 S\u3002\u5982\u679c\u8fd9 \u53c2\u6570\uff0c\u5219\u5728 \u4f7f\u7528\u8fdc\u7a0b\u5bf9\u8c61\u5b9e\u4f8b\u3002\u5220\u9664\u8bb0\u5f55\u7684\u6700\u7b80\u5355\u65b9\u6cd5\u662f\u8c03\u7528 \u672c\u8eab\u3002<\/p>\n\n\n\n<p><samp>Id<\/samp><samp>Id<\/samp><samp>del()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctDetails = {FirstName: \"Tobe\", LastName: \"Ornottobe\"};\nct = new RemoteObjectModel.Contact(ctDetails);\nct.create();\n\n\/\/ After some thought, and the async operation completes...\n\/\/ It's not to be; delete the contact\nct.del();<\/code><\/pre>\n\n\n\n<p>\u66f4\u5e38\u89c1\u7684\u662f\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u5220\u9664\u8bb0\u5f55\u4ee5\u54cd\u5e94 \u6309\u94ae\u5355\u51fb\u3002\u5220\u9664\u8bb0\u5f55\u5c31\u50cf\u4ece\u9875\u9762\u4e2d\u83b7\u53d6\u8bb0\u5f55\u7136\u540e\u4f20\u9012\u4e00\u6837\u7b80\u5355 \u7684 \u5230 .\u4f8b\u5982\uff1a<\/p>\n\n\n\n<p><samp>Id<\/samp><samp>Id<\/samp><samp>del()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var id = $jQuery('#contactId').val();\nvar ct = new RemoteObjectModel.Contact();\nct.del(id);<\/code><\/pre>\n\n\n\n<p>\u53ef\u9760\u7684\u4ee3\u7801\u5305\u62ec\u7528\u4e8e\u5904\u7406\u9519\u8bef\u7684\u56de\u8c03\u3002\u4ee5\u4e0b \u4ee3\u7801\u7684\u5b8c\u6210\u65b9\u5f0f\u4e0e\u4e0a\u4e00\u4e2a\u793a\u4f8b\u76f8\u540c\uff0c\u4f46\u5df2\u66f4\u6539\u4e3a\u4f7f\u7528 \u4e8b\u4ef6\u5904\u7406\u7a0b\u5e8f\u548c\u56de\u8c03\u51fd\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Handle the delete button click\nfunction deleteContact(e){\n    e.preventDefault();\n    var ct = new RemoteObjectModel.Contact();\n    ct.del($jQuery('#contactId').val(), updateCallback);\n}\n\n\/\/ Callback to handle DML Remote Objects calls\nfunction updateCallback(err, ids){\n    if (err) { \n        displayError(err); \n    } else {\n        \/\/ Reload the contacts with current list\n        getAllContacts();\n        $jQuery.mobile.changePage('#listpage', {changeHash: true});\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u8981\u5220\u9664\u4e00\u4e2a\u8bf7\u6c42\u4e2d\u7684\u591a\u6761\u8bb0\u5f55\uff0c\u4f8b\u5982\uff0c\u9009\u4e2d \u5217\u8868\u4e2d\u7684\u9879\u76ee &#8211; \u5c06 s \u6570\u7ec4\u4f20\u9012\u7ed9 \u3002<\/p>\n\n\n\n<p><samp>Id<\/samp><samp>del()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var ct = new RemoteObjectModel.Contact();\nct.del(&#91;'003xxxxxxxxxxxxxxx', '003xxxxxxxxxxxxxxx'], function(err, ids) {\n    if (err) { \n        displayError(err); \n    } else {\n        \/\/ Reload the contacts with current list\n        getAllContacts();\n        $jQuery('#status').html(ids.length + ' record(s) deleted.');\n        $jQuery.mobile.changePage('#listpage', {changeHash: true});\n    }\n});<\/code><\/pre>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u5f53\u60a8\u4ee5\u8fd9\u79cd\u65b9\u5f0f\u5220\u9664\u591a\u6761\u8bb0\u5f55\u65f6\uff0c\u6240\u6709 \u7684\u8bb0\u5f55\u5c06\u5728\u540c\u4e00\u670d\u52a1\u5668\u7aef\u4e8b\u52a1\u4e2d\u5220\u9664\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fdc\u7a0b\u7684\u683c\u5f0f\u548c\u9009\u9879 \u5bf9\u8c61\u67e5\u8be2\u6761\u4ef6<\/h2>\n\n\n\n<p>\u8fdc\u7a0b \u5bf9\u8c61\u4f7f\u7528\u5bf9\u8c61\u6765\u6307\u5b9a\u64cd\u4f5c\u6761\u4ef6\u3002\u4f7f\u7528\u6b64\u5bf9\u8c61 \u6307\u5b9a\u67e5\u8be2\u7684\u4f4d\u7f6e\u3001\u9650\u5236\u548c\u504f\u79fb\u6761\u4ef6\u3002<\/p>\n\n\n\n<p><samp>retrieve()<\/samp>\u67e5\u8be2\u5bf9\u8c61\u7684\u7ed3\u6784\u5316\u683c\u5f0f\u4f7f Visualforce \u80fd\u591f\u9a8c\u8bc1 \u6807\u51c6\uff0c\u51cf\u5c11\u8fd0\u884c\u65f6\u9519\u8bef\u7684\u53ef\u80fd\u6027\u3002\u683c\u5f0f\u4e3a \u7b80\u5355\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:remoteObjectsjsNamespace=\"RemoteObjectModel\"&gt;    \n    &lt;apex:remoteObjectModel name=\"Contact\" fields=\"FirstName,LastName\"\/&gt;  \n&lt;\/apex:remoteObjects&gt;\n\n&lt;script&gt;\nvar ct = new RemoteObjectModel.Contact();\nct.retrieve( \n    { where: { \n        FirstName: {eq: 'Marc'}, \n        LastName: {eq: 'Benioff'} \n      }, \n      orderby: &#91; {LastName: 'ASC'}, {FirstName: 'ASC'} ],\n      limit: 1 },  \n\n    function(err, records) { \n        if (err) { \n            alert(err); \n        } else { \n            console.log(records.length); \n            console.log(records&#91;0]); \n        } \n    } \n);\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<p>\u8fd9 \u67e5\u8be2\u6761\u4ef6\uff1a\u627e\u5230\u540d\u4e3a Marc Benioff \u7684\u8054\u7cfb\u4eba\uff0c\u5e76\u5c06\u67e5\u8be2\u9650\u5236\u4e3a\u5355\u4e2a \u7ed3\u679c\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u54ea\u91cc\u6761\u4ef6<\/h2>\n\n\n\n<p><samp>where<\/samp>\u6761\u4ef6\u4f7f\u60a8\u80fd\u591f\u7b5b\u9009 \u68c0\u7d22\u64cd\u4f5c\u7684\u7ed3\u679c\uff0c\u4e0e SOQL \u67e5\u8be2\u4e2d\u7684\u6761\u4ef6\u5927\u81f4\u76f8\u540c\u3002\u53ef\u7528\u7684\u8fd0\u7b97\u7b26 \u6761\u4ef6\u662f\uff1a<\/p>\n\n\n\n<p><samp>WHERE<\/samp><samp>where<\/samp><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><samp>eq<\/samp>\uff1a\u7b49\u4e8e<\/li>\n\n\n\n<li><samp>ne<\/samp>\uff1a\u4e0d\u7b49\u4e8e<\/li>\n\n\n\n<li><samp>lt<\/samp>\uff1a\u5c0f\u4e8e<\/li>\n\n\n\n<li><samp>lte<\/samp>\uff1a\u5c0f\u4e8e\u6216\u7b49\u4e8e<\/li>\n\n\n\n<li><samp>gt<\/samp>\uff1a\u5927\u4e8e<\/li>\n\n\n\n<li><samp>gte<\/samp>\uff1a\u5927\u4e8e\u6216\u7b49\u4e8e<\/li>\n\n\n\n<li><samp>like<\/samp>\uff1a\u5b57\u7b26\u4e32\u5339\u914d\u3002\u4e0e SOQL\uff0c\u4f7f\u7528\u201c%\u201d\u4f5c\u4e3a\u901a\u914d\u7b26\u3002<\/li>\n\n\n\n<li><a><\/a><samp>in<\/samp>\uff1ain\uff0c\u7528\u4e8e\u67e5\u627e\u4e0e\u4e00\u7ec4 \u56fa\u5b9a\u503c\u3002<a><\/a>\u63d0\u4f9b \u503c\u4f5c\u4e3a\u6570\u7ec4\uff0c\u4f8b\u5982 [&#8216;Benioff&#8217;\uff0c &#8216;Jobs&#8217;\uff0c &#8216;\u76d6\u8328&#8217;]\u3002<\/li>\n\n\n\n<li><a><\/a><samp>nin<\/samp>\uff1anot in\uff0c\u7528\u4e8e\u67e5\u627e\u4e0e \u4e00\u7ec4\u56fa\u5b9a\u503c\u3002\u63d0\u4f9b \u503c\u4f5c\u4e3a\u6570\u7ec4\uff0c\u4f8b\u5982 [&#8216;Benioff&#8217;\uff0c &#8216;Jobs&#8217;\uff0c &#8216;\u76d6\u8328&#8217;]\u3002<\/li>\n\n\n\n<li><samp>and<\/samp>\uff1a\u903b\u8f91 AND\uff0c\u7528\u4e8e \u7ec4\u5408\u6761\u4ef6<\/li>\n\n\n\n<li><samp>or<\/samp>\uff1a\u903b\u8f91 OR\uff0c\u7528\u4e8e\u7ec4\u5408 \u6761\u4ef6<\/li>\n<\/ul>\n\n\n\n<p>\u5728\u5bf9\u8c61\u4e2d\uff0c\u6dfb\u52a0\u5b57\u6bb5\u540d\u79f0\u548c \u6761\u4ef6\u5bf9\u4ee5\u521b\u5efa\u590d\u6742\u7684\u6761\u4ef6\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u591a\u4e2a\u6761\u4ef6\u662f \u89c6\u4e3a AND \u6761\u4ef6\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 \u548c \u521b\u5efa\u5176\u4ed6\u6761\u4ef6\u6761\u4ef6\u3002 \u4e3a \u4f8b\uff1a<\/p>\n\n\n\n<p><samp>where<\/samp><samp>and<\/samp><samp>or<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{ \nwhere: \n    { \n    or: \n        {\n        FirstName: { like: \"M%\" }, \n        Phone: { like: '(415)%' }\n        }\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u4f7f\u7528 \u548c \u7684\u7ec4\u5408\u6839\u636e\u65e5\u671f\u8303\u56f4\u7b5b\u9009\u7ed3\u679c\u3002\u4f8b\u5982\uff1a<samp>lte<\/samp><samp>gte<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:remoteObjects jsNamespace=\"RemoteObjectModel\"&gt;\n    &lt;apex:remoteObjectModel name=\"Account\" fields=\"Id,Name,CreatedDate\"\/&gt;\n&lt;\/apex:remoteObjects&gt;\n\n&lt;script&gt;\n    var account_created_from_date = new Date('2017-01-01');\n    var account_created_to_date = new Date('2018-01-01');\n    var clauses = {       \n        'where': {\n            'CreatedDate': { 'lte': account_created_to_date },\n            'and': {\n                'CreatedDate': { 'gte': account_created_from_date },\n                'Id': { 'ne': '' }\n            }\n        }   \n    };\n\n    var ct = new RemoteObjectModel.Account();\n    ct.retrieve(\n        clauses,\n        function(err, records) { \n            if (err) { \n                console.log(err); \n            } else { \n                console.log(records.length); \n                console.log(records&#91;0]); \n            } \n        } \n    );\n&lt;\/script&gt;<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u8ba2\u8d2d\u8005\u6761\u4ef6<\/h2>\n\n\n\n<p><samp>orderby<\/samp>\u4f7f\u60a8\u80fd\u591f \u4e3a\u7ed3\u679c\u8bbe\u7f6e\u6392\u5e8f\u987a\u5e8f\u3002\u60a8\u6700\u591a\u53ef\u4ee5\u5bf9\u4e09\u4e2a\u5b57\u6bb5\u8fdb\u884c\u6392\u5e8f\u3002\u6307\u5b9a\u6761\u4ef6 \u4f5c\u4e3a\u5305\u542b\u540d\u79f0\/\u503c\u5bf9\u7684 JavaScript \u5bf9\u8c61\u6570\u7ec4\u3002\u8fd9 \u8981\u6392\u5e8f\u7684\u5b57\u6bb5\u662f\u540d\u79f0\uff0c\u6392\u5e8f\u8bf4\u660e\u662f\u503c\u3002 \u6392\u5e8f\u8bf4\u660e\u4f7f\u60a8\u80fd\u591f\u6309\u5347\u5e8f\u6216\u964d\u5e8f\u6392\u5e8f\uff0c\u5e76 \u5bf9 NULL \u503c\u8fdb\u884c\u6392\u5e8f\u3002\u4f8b\u5982\uff1a<\/p>\n\n\n\n<p><samp>orderby<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>orderby: &#91; {Phone: \"DESC NULLS LAST\"} , {FirstName: \"ASC\"} ]<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">\u9650\u5236\u548c\u504f\u79fb\u6761\u4ef6<\/h2>\n\n\n\n<p><samp>limit<\/samp>\u5e76\u4f7f\u60a8\u80fd\u591f\u68c0\u7d22\u7279\u5b9a\u7684 \u4e00\u6b21\u8bb0\u5f55\u6570\uff0c\u5e76\u7ffb\u9605\u4e00\u7ec4\u6269\u5c55\u7684 \u7ed3\u679c\u3002<samp>offset<\/samp><\/p>\n\n\n\n<p>\u7528\u4e8e \u6307\u5b9a\u5728\u4e00\u6279\u7ed3\u679c\u4e2d\u8981\u8fd4\u56de\u7684\u8bb0\u5f55\u6570\u3002\u9ed8\u8ba4 \u503c\u4e3a 20\u3002\u6700\u5927\u503c\u4e3a 100\u3002<samp>limit<\/samp><\/p>\n\n\n\n<p>\u7528\u4e8e\u6307\u5b9a\u8981\u8df3\u8fc7\u7684\u8bb0\u5f55\u6570 \u5728\u5c06\u8bb0\u5f55\u6dfb\u52a0\u5230\u8fd4\u56de\u7ed3\u679c\u4e4b\u524d\u7684\u603b\u4f53\u7ed3\u679c\u96c6\u3002\u6700\u5c0f\u503c\u4e3a 1\u3002 \u6700\u5927\u504f\u79fb\u91cf\u4e3a 2,000 \u884c\u3002\u8bf7\u6c42 \u5927\u4e8e 2,000 \u7684\u504f\u79fb\u91cf\u4f1a\u5bfc\u81f4\u9519\u8bef\u3002<samp>offset<\/samp><samp>NUMBER_OUTSIDE_VALID_RANGE<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fdc\u7a0b \u5bf9\u8c61\u56de\u8c03\u51fd\u6570<\/h2>\n\n\n\n<p>\u8fdc\u7a0b \u5bf9\u8c61\u4ee5\u5f02\u6b65\u65b9\u5f0f\u5c06\u6240\u6709\u8bf7\u6c42\u53d1\u9001\u5230 Salesforce \u670d\u52a1\u3002\u4ee3\u7801\u5904\u7406\u54cd\u5e94 \u5230\u8fdc\u7a0b \u60a8\u63d0\u4f9b\u7684\u56de\u8c03\u51fd\u6570\u4e2d\u7684\u5bf9\u8c61\u64cd\u4f5c\u3002\u56de\u8c03\u51fd\u6570\u5904\u7406\u66f4\u65b0 \u5305\u542b\u64cd\u4f5c\u7ed3\u679c\u548c\u8fd4\u56de\u7684\u9519\u8bef\u7684\u9875\u9762\u3002<\/p>\n\n\n\n<p id=\"vf_remoteobjects_callback_functions_description\"><a><\/a>\u56de\u8c03\u51fd\u6570\u662f\u6807\u51c6 JavaScript \u4e2d\u7528\u4e8e\u5904\u7406\u4e8b\u4ef6\u548c\u5f02\u6b65\u64cd\u4f5c\u7684\u6280\u672f\u3002\u8fdc\u7a0b \u5bf9\u8c61\u4f7f\u7528\u6b64\u6a21\u5f0f\u6765\u5904\u7406\u5176\u5f02\u6b65\u64cd\u4f5c\u7684\u54cd\u5e94\u3002\u5f53\u4f60 \u8c03\u7528\u8fdc\u7a0b \u5bf9\u8c61\u64cd\u4f5c\uff0c\u60a8\u53ef\u4ee5\u63d0\u4f9b\u64cd\u4f5c\u7684\u53c2\u6570\u548c\u56de\u8c03\uff08\u53ef\u9009\uff09 \u529f\u80fd\u3002\u8c03\u7528\u64cd\u4f5c\u540e\uff0cJavaScript \u4ee3\u7801\u5c06\u7ee7\u7eed\u4e0d\u95f4\u65ad\u5730\u8fd0\u884c\u3002 \u5f53\u8fdc\u7a0b\u64cd\u4f5c\u5b8c\u6210\u5e76\u8fd4\u56de\u7ed3\u679c\u65f6\uff0c\u56de\u8c03\u51fd\u6570 \u88ab\u8c03\u7528\u5e76\u63a5\u6536\u64cd\u4f5c\u7684\u7ed3\u679c\u3002\u8fdc\u7a0b \u53ef\u4ee5\u7f16\u5199\u5bf9\u8c61\u56de\u8c03\u51fd\u6570\u4ee5\u63a5\u6536\u6700\u591a\u4e09\u4e2a\u53c2\u6570\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function <em>callback<\/em>(Error <em>error<\/em>, Array <em>results<\/em>, Object <em>event<\/em>) { \/\/ ... }<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>\u540d\u5b57<\/th><th>\u7c7b\u578b<\/th><th>\u63cf\u8ff0<\/th><\/tr><\/thead><tbody><tr><td>\u9519\u8bef<\/td><td>JavaScript\u00a0Error\u00a0\u5bf9\u8c61<\/td><td>\u6807\u51c6 JavaScript Error \u5bf9\u8c61\u3002\u5982\u679c\u64cd\u4f5c\u6210\u529f\uff0c\u5219\u4e3a \u3002\u7528\u4e8e\u68c0\u7d22 \u5931\u8d25\u7684\u539f\u56e0\u3002<samp>error<\/samp><samp>null<\/samp><samp>error.message<\/samp><\/td><\/tr><tr><td>\u7ed3\u679c<\/td><td>JavaScript \u6570\u7ec4<\/td><td>\u4e00\u4e2a\u6570\u7ec4\uff0c\u5305\u542b\u64cd\u4f5c\u7684\u7ed3\u679c\u3002\u5982\u679c \u64cd\u4f5c\u662f\u4e00\u4e2a\uff0c \u7ed3\u679c\u662f\u76f8\u5e94 Remote \u7684\u5b9e\u4f8b \u5bf9\u8c61\u3002\u5426\u5219\uff0c\u6570\u7ec4\u5305\u542b\u8868\u793a\u53d7\u5f71\u54cd \u8bb0\u5f55\u3002<samp>retrieve()<\/samp><samp>Id<\/samp><\/td><\/tr><tr><td>\u4e8b\u4ef6<\/td><td>JavaScript \u5bf9\u8c61<\/td><td>\u4e00\u4e2a JavaScript \u5bf9\u8c61\uff0c\u8be5\u5bf9\u8c61\u63d0\u4f9b\u4f20\u8f93 Remote \u7684 JavaScript \u8fdc\u7a0b\u5904\u7406\u4e8b\u4ef6\u7684\u8be6\u7ec6\u4fe1\u606f \u5bf9\u8c61\u64cd\u4f5c\u3002<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u5927\u591a\u6570\u56de\u8c03\u51fd\u6570\u4f1a\u68c0\u67e5\u9519\u8bef\uff0c\u7136\u540e\u4f7f\u7528 \u7ed3\u679c\u3002\u901a\u5e38\u4f7f\u7528\u8be5\u5bf9\u8c61 \u4ec5\u5728\u8c03\u8bd5\u548c\u590d\u6742\u7684\u9519\u8bef\u7ba1\u7406\u65b9\u9762\u3002<\/p>\n\n\n\n<p><samp>event<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f8b<\/h2>\n\n\n\n<p>\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u56de\u8c03\u51fd\u6570\uff0c\u7528\u4e8e\u5904\u7406\u64cd\u4f5c\u7684\u7ed3\u679c\u3002<\/p>\n\n\n\n<p><samp>retrieve()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>function getAllContacts() {\n    $j.mobile.showPageLoadingMsg();\n    \n    var c = new RemoteObjectModel.Contact();\n    c.retrieve({ limit: 100 }, function (err, records) { \n        \/\/ Handle errors\n        if (err) { \n            displayError(err); \n        } else {\n            \/\/ Add the results to the page\n            var list = $j(Config.Selectors.list).empty();\n            $j.each(records, function() {\n                var newLink = $j('&lt;a&gt;'+this.get('FirstName')+' '+this.get('LastName')+'&lt;\/a&gt;');\n                newLink.appendTo(list).wrap('&lt;li&gt;&lt;\/li&gt;');\n            });\n            \n            $j.mobile.hidePageLoadingMsg();\n            list.listview('refresh');\n        }\n    });\n}<\/code><\/pre>\n\n\n\n<p>\u5728 \u6b64\u793a\u4f8b\u8c03\u7528\u533f\u540d\u51fd\u6570\u5e76\u5c06\u5176\u4f20\u9012\u4e3a \u56de\u8c03\u3002\u56de\u8c03\u51fd\u6570\u68c0\u67e5\u9519\u8bef\uff0c\u7136\u540e\u4f7f\u7528 jQuery \u5faa\u73af\u8bbf\u95ee\u7ed3\u679c\u8bb0\u5f55\u6570\u7ec4\uff0c\u5e76\u5c06\u5b83\u4eec\u6dfb\u52a0\u5230\u9875\u9762\u4e2d\u3002\u4e00\u4e9b\u7ec6\u8282 \u7701\u7565\u4ee5\u4e13\u6ce8\u4e8e\u56de\u8c03\u7ed3\u6784\u3002\u8bf7\u53c2\u9605\u4f7f\u7528\u8fdc\u7a0b\u7684\u793a\u4f8b \u5e26\u6709 jQuery Mobile \u7684\u5bf9\u8c61\uff0c\u7528\u4e8e\u83b7\u53d6\u5b8c\u6574\u7684\u9875\u9762\u6e90\u4ee3\u7801\u3002<\/p>\n\n\n\n<p><samp>getAllContacts()<\/samp><samp>retrieve()<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8986\u76d6\u9ed8\u8ba4\u8fdc\u7a0b\u5bf9\u8c61\u64cd\u4f5c<\/h2>\n\n\n\n<p>\u8986\u76d6\u9ed8\u8ba4\u7684\u8fdc\u7a0b \u4f7f\u7528\u60a8\u81ea\u5df1\u7684 Apex \u4ee3\u7801\u8fdb\u884c\u5bf9\u8c61\u64cd\u4f5c\uff0c\u4ee5\u6269\u5c55\u6216\u81ea\u5b9a\u4e49 Remote \u7684\u884c\u4e3a \u5bf9\u8c61\u3002<\/p>\n\n\n\n<p>Remote \u5e55\u540e\u82b1\u7d6e \u5bf9\u8c61\u3001\u57fa\u672c\u64cd\u4f5c\u2014, , ,\u548c \u2014\u4f7f\u7528 Remote \u5bf9\u8c61\u63a7\u5236\u5668\uff0c\u76f8\u5f53\u4e8e\u666e\u901a Visualforce \u9875\u9762\u7684\u6807\u51c6\u63a7\u5236\u5668\u3002\u60a8\u53ef\u4ee5 \u8986\u76d6\u8fdc\u7a0b \u7528\u4e8e\u6269\u5c55\u6216\u66ff\u6362\u6b64\u63a7\u5236\u5668\u7684\u5185\u7f6e\u884c\u4e3a\u7684\u5bf9\u8c61\u64cd\u4f5c\u3002\u91cd\u5199 \u8fdc\u7a0b\u7684 \u5bf9\u8c61\u64cd\u4f5c\u662f\u7528 Apex \u7f16\u5199\u7684\uff0c\u5e76\u901a\u8fc7\u5c06\u5b83\u4eec\u6dfb\u52a0\u5230\u9875\u9762\u7684 Remote \u4e2d\u6765\u751f\u6548 \u5bf9\u8c61\u5b9a\u4e49\u3002<samp>create()<\/samp><samp>retrieve()<\/samp><samp>update()<\/samp><samp>del()<\/samp><\/p>\n\n\n\n<p>\u6ce8\u610f<\/p>\n\n\n\n<p>\u65e0\u6cd5\u91cd\u5199\u8be5\u64cd\u4f5c\u3002 \u5b83\u53ea\u662f\u4e00\u4e2a\u4fbf\u5229\u529f\u80fd\uff0c\u5728\u5e55\u540e\u5b83\u59d4\u6258\u7ed9 either \u6216 .\u91cd\u5199\u5176\u4e2d\u4efb\u4e00\u65b9\u6cd5\u65f6\uff0c\u91cd\u5199\u7684\u65b9\u6cd5 \u88ab\u81ea\u52a8\u7528\u4f5c \u9002\u5f53\u3002<samp>upsert()<\/samp><samp>create()<\/samp><samp>update()<\/samp><samp>upsert()<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fdc\u7a0b \u65b9\u6cd5\u91cd\u5199\u7684\u5bf9\u8c61\u8bbf\u95ee\u5b9a\u4e49<\/h2>\n\n\n\n<p>\u8986\u76d6\u8fdc\u7a0b\u4f7f\u7528\u8fdc\u7a0b\u65b9\u6cd5\u5bf9\u5bf9\u8c61\u8fdb\u884c\u64cd\u4f5c\uff0c\u5c06\u64cd\u4f5c\u7684\u5c5e\u6027\u8bbe\u7f6e\u4e3a\u65b9\u6cd5 \u66ff\u6362\u9ed8\u8ba4\u65b9\u6cd5\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u4ecb\u7ecd\u5982\u4f55\u4f7f\u7528\u8fdc\u7a0b\u8986\u76d6\u8054\u7cfb\u4eba\u7684\u64cd\u4f5c \u65b9\u6cd5\u3002<\/p>\n\n\n\n<p><samp>create()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:remoteObjectModel name=\"Contact\" fields=\"FirstName,LastName,Phone\" \n    create=\"{!$RemoteAction.RemoteObjectContactOverride.create}\"\/&gt;<\/code><\/pre>\n\n\n\n<p><a><\/a>\u8be5\u5c5e\u6027\u91c7\u7528 \u89c6\u89c9\u529b \u5f15\u7528\u8981\u7528\u4f5c\u5185\u7f6e\u64cd\u4f5c\u91cd\u5199\u7684\u65b9\u6cd5\u7684\u8868\u8fbe\u5f0f\u3002<samp>@RemoteAction<\/samp><samp>create()<\/samp>\u8fd9 \u8868\u8fbe\u5f0f\u91c7\u7528 \u7684\u5f62\u5f0f\uff0c\u4e3a \u5168\u5c40\u5904\u7406\u60a8\u7684\u4f4d\u7f6e \u7ec4\u7ec7\u547d\u540d\u7a7a\u95f4\uff0c\u5c31\u50cf JavaScript \u8fdc\u7a0b\u5904\u7406\u4e00\u6837\u3002\u8bf7\u6ce8\u610f\uff0c \u5305\u542b\u8be5\u65b9\u6cd5\u7684\u7c7b \u9700\u8981\u8bbe\u7f6e\u4e3a\u9875\u9762\u7684\u63a7\u5236\u5668\u6216\u63a7\u5236\u5668\u6269\u5c55 \u9875\u3002<samp>$RemoteAction.<var>OverrideClassName<\/var>.<var>overrideMethodName<\/var><\/samp><samp>$RemoteAction<\/samp><samp>@RemoteAction<\/samp><\/p>\n\n\n\n<p>\u4f7f\u7528\u6b64\u58f0\u660e\uff0c\u6bcf\u5f53\u9875\u9762\u7684 JavaScript \u4ee3\u7801\u8c03\u7528\u8054\u7cfb\u4eba\u8fdc\u7a0b\u5bf9\u8c61\u7684\u51fd\u6570\u65f6\uff0c \u800c\u4e0d\u662f\u4f7f\u7528\u8fdc\u7a0b\u5bf9\u8c61\u63a7\u5236\u5668\uff0c\u5c06\u8c03\u7528\u60a8\u7684\u8fdc\u7a0b\u65b9\u6cd5\u3002<samp>create()<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fdc\u7a0b \u5bf9\u8c61\u91cd\u5199\u65b9\u6cd5<\/h2>\n\n\n\n<p>\u8fdc\u7a0b \u5bf9\u8c61\u91cd\u5199\u65b9\u6cd5\u4f5c\u4e3a Apex \u7c7b\u4e2d\u7684\u65b9\u6cd5\u7f16\u5199\uff0c\u60a8\u53ef\u4ee5\u5c06\u5176\u4f5c\u4e3a \u63a7\u5236\u5668\u6216\u63a7\u5236\u5668\u6269\u5c55\u3002<samp>@RemoteAction<\/samp>\u91cd\u5199\u7684\u65b9\u6cd5\u7b7e\u540d \u65b9\u6cd5 \u662f\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@RemoteAction\npublic static Map&lt;String,Object&gt; <em>methodName<\/em>(String type, Map&lt;String,Object&gt; fields)<\/code><\/pre>\n\n\n\n<p>type&nbsp;\u53c2\u6570\u662f\u6b63\u5728\u6267\u884c\u64cd\u4f5c\u7684 sObject \u7c7b\u578b\uff0c&nbsp;\u5b57\u6bb5\u6620\u5c04\u662f\u5305\u542b\u503c\u7684\u96c6\u5408 \u5728\u91cd\u5199\u65b9\u6cd5\u4e4b\u524d\u5728\u8fdc\u7a0b\u5bf9\u8c61\u4e0a\u8bbe\u7f6e\u7684 \u53eb\u3002<\/p>\n\n\n\n<p>\u8fd4\u56de\u503c\u662f\u8868\u793a Remote \u7ed3\u679c\u7684\u6620\u5c04 \u5bf9\u8c61\u64cd\u4f5c\u3002\u6b64\u6620\u5c04\u901a\u5e38\u5305\u62ec\u8c03\u7528\u7ed3\u679c\u3001\u72b6\u6001\u548c \u8981\u4f5c\u4e3a\u81ea\u5b9a\u4e49\u65b9\u6cd5\u7684\u4e00\u90e8\u5206\u63d0\u4f9b\u7684\u4efb\u4f55\u81ea\u5b9a\u4e49\u6570\u636e\u3002\u8fd9 \u6784\u9020\u6709\u6548\u8fd4\u56de\u6620\u5c04\u7684\u6700\u7b80\u5355\u65b9\u6cd5\u662f\u4f7f\u7528 .\u8fd9\u662f\u6807\u51c6 \u4e3a\u8fdc\u7a0b\u63d0\u4f9b\u5185\u7f6e\u529f\u80fd\u7684\u63a7\u5236\u5668 \u5bf9\u8c61\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u5c06\u6570\u636e\u64cd\u4f5c\u8bed\u8a00 \uff08DML\uff09 \u64cd\u4f5c\u59d4\u6258\u7ed9\u5b83 \u4f20\u9012\u65b9\u6cd5\u7684\u53c2\u6570\u3002\u4f8b\u5982\uff0c\u8fd9\u91cc\u6709\u4e00\u4e2a\u65b9\u6cd5\uff0c\u5b83\u53ea\u6267\u884c \u7684\u5185\u7f6e\u7248\u672c\uff1a<\/p>\n\n\n\n<p><samp>RemoteObjectController<\/samp><samp>create()<\/samp><samp>create()<\/samp><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>@RemoteAction\npublic static Map&lt;String, Object&gt; create(String type, Map&lt;String, Object&gt; fields) {\n    Map&lt;String, Object&gt; result = RemoteObjectController.create(type, fields);\n    return result;\n}<\/code><\/pre>\n\n\n\n<p>\u8fd9 \u65b9\u6cd5\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a\u7a7a\u64cd\u4f5c;\u4e5f\u5c31\u662f\u8bf4\uff0c\u6b64\u65b9\u6cd5\u6267\u884c\u5b8c\u5168\u76f8\u540c\u7684\u64cd\u4f5c \u5185\u7f6e\u7248\u672c\u672c\u6765\u53ef\u4ee5\u505a\u5230\u7684\uff0c\u4e0d\u591a\u4e5f\u4e0d\u5c11\u3002\u60a8\u7684\u8986\u76d6\u65b9\u6cd5 \u53ef\u4ee5\u6267\u884c\u60a8\u9700\u8981\u7684\u4efb\u4f55\u5176\u4ed6 Apex\uff0c\u5305\u62ec\u65e5\u5fd7\u8bb0\u5f55\u3001\u989d\u5916\u7684 DML\u3001 \u5176\u4ed6\u65b9\u6cd5\u8c03\u7528\uff0c\u4f9d\u6b64\u7c7b\u63a8\u3002\u6709\u5173\u8fdc\u7a0b\u7684\u66f4\u5b8c\u6574\u793a\u4f8b \u5bf9\u8c61\u91cd\u5199\u65b9\u6cd5\u4ee5\u53ca\u4f7f\u7528\u5b83\u7684\u9875\u9762\uff0c\u8bf7\u53c2\u9605\u5728\u8fdc\u7a0b\u4e2d\u4f7f\u7528\u8fdc\u7a0b\u65b9\u6cd5\u91cd\u5199\u7684\u793a\u4f8b \u5bf9\u8c61\u3002<\/p>\n\n\n\n<p>\u91cd\u8981<\/p>\n\n\n\n<p>\u6807\u51c6\u63a7\u5236\u5668\u81ea\u52a8\u5904\u7406 \u5171\u4eab Remote \u7684\u89c4\u5219\u3001\u6240\u6709\u6743\u548c\u5176\u4ed6\u5b89\u5168\u95ee\u9898 \u5bf9\u8c61\u3002\u76f8\u6bd4\u4e4b\u4e0b\uff0c\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u6216\u63a7\u5236\u5668\u6269\u5c55\u4e2d\u7684\u65b9\u6cd5\u5728 \u7cfb\u7edf\u6a21\u5f0f\uff0c\u5141\u8bb8\u5bf9\u7ec4\u7ec7\u4e2d\u7684\u6240\u6709\u6570\u636e\u8fdb\u884c\u5b8c\u5168\u8bbf\u95ee\u3002 \u6b64\u884c\u4e3a\u4e0e\u4f7f\u7528 \u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u6216\u63a7\u5236\u5668\u6269\u5c55\u3002\u5f53\u60a8\u7f16\u5199\u63a7\u5236\u5668\u4ee3\u7801\u65f6\uff0c\u60a8 \u9700\u8981\u81ea\u5df1\u5904\u7406\u8bbf\u95ee\u6743\u9650\u548c\u5176\u4ed6\u95ee\u9898\u3002<samp>RemoteObjectController<\/samp><\/p>\n\n\n\n<p>\u6700\u4f73\u505a\u6cd5\u662f\u4f7f\u7528 \u4f60\u7684\u5173\u952e\u8bcd \u63a7\u5236\u5668\u6216\u63a7\u5236\u5668\u6269\u5c55\u7c7b\uff0c\u5e76\u5c3d\u53ef\u80fd\u591a\u5730\u59d4\u6258\u7ed9 .<samp>with sharing<\/samp><samp>RemoteObjectController<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5728 Remote \u4e2d\u4f7f\u7528 Remote \u65b9\u6cd5\u91cd\u5199\u7684\u793a\u4f8b \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u6b64\u793a\u4f8b\u4ee3\u7801\u6f14\u793a\u5982\u4f55\u4e3a Remote \u521b\u5efa\u8fdc\u7a0b\u65b9\u6cd5\u91cd\u5199 \u5bf9\u8c61\u64cd\u4f5c\u3002\u8be5\u793a\u4f8b\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6392\u5e8f\u7684\u8054\u7cfb\u4eba\u5217\u8868\u548c\u4e00\u4e2a\u7528\u4e8e\u8f93\u5165 \u65b0\u8054\u7cfb\u4eba\u3002\u65b0\u7684\u8054\u7cfb\u4eba\u64cd\u4f5c\u5c06\u8986\u76d6\u5185\u7f6e\u7684\u8fdc\u7a0b \u5bf9\u8c61\u64cd\u4f5c\u3002\u8be5\u793a\u4f8b\u8fd8\u6f14\u793a\u4e86 \u6df7\u5408\u8fdc\u7a0b\u5177\u6709\u591a\u4e2a Web \u5f00\u53d1\u5e93\u7684\u5bf9\u8c61\uff0c\u7528\u4e8e\u5448\u73b0\u9002\u5408\u79fb\u52a8\u8bbe\u5907\u7684\u7528\u6237 \u63a5\u53e3\u3002<\/p>\n\n\n\n<p><samp>create()<\/samp><\/p>\n\n\n\n<p>\u6b64\u793a\u4f8b\u4f7f\u7528 jQuery\u3001Bootstrap \u548c Mustache \u5de5\u5177\u5305\uff0c\u4ece \u5916\u90e8\u5185\u5bb9\u5206\u53d1\u7f51\u7edc \uff08CDN\uff09\u3002<img fetchpriority=\"high\" decoding=\"async\" width=\"760\" height=\"526\" class=\"wp-image-4151\" style=\"\" src=\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/12\/table.png\" alt=\"\" srcset=\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/12\/table.png 760w, http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/12\/table-300x208.png 300w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/>\u8fd9\u662f Visualforce \u9875\u9762\uff0c\u5176\u4e2d\u5305\u542b \u5927\u80c6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page showHeader=\"false\" standardStylesheets=\"false\" docType=\"html-5.0\" \n    title=\"Contacts\u2014RemoteObjects Style\" controller=\"RemoteObjectContactOverride\"&gt;\n\n    &lt;!-- Include in some mobile web libraries --&gt;\n    &lt;apex:stylesheet value=\"\/\/netdna.bootstrapcdn.com\/bootswatch\/3.1.1\/superhero\/bootstrap.min.css\"\/&gt;\n    &lt;apex:includeScript value=\"\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/1.11.0\/jquery.min.js\"\/&gt;\n    &lt;apex:includeScript value=\"\/\/cdnjs.cloudflare.com\/ajax\/libs\/mustache.js\/0.7.2\/mustache.min.js\"\/&gt;\n\n    &lt;!-- Set up Remote Objects, with an override for create() method --&gt;\n    &lt;apex:remoteObjects jsNamespace=\"$M\"&gt;\n        &lt;apex:remoteObjectModel name=\"Contact\" fields=\"FirstName,LastName,Phone\" \n            create=\"{!$RemoteAction.RemoteObjectContactOverride.create}\"\/&gt;\n    &lt;\/apex:remoteObjects&gt;\n\n    &lt;!-- Page markup --&gt;\n    &lt;div class=\"container\"&gt;\n        &lt;div class=\"row\"&gt;\n            &lt;div class=\"col-md-2\"&gt;&lt;\/div&gt;\n            &lt;div class=\"col-md-8\"&gt;\n                &lt;table id=\"myTable\" \n                    class=\"table table-bordered table-striped table-condensed\"&gt;\n                    &lt;colgroup&gt;\n                        &lt;col class=\"col-md-3\" \/&gt;\n                        &lt;col class=\"col-md-3\" \/&gt;\n                        &lt;col class=\"col-md-3\" \/&gt;\n                    &lt;\/colgroup&gt;\n                    &lt;caption&gt;\n                        Contact Data Order (&#91; {LastName: 'ASC'}, {FirstName: 'DESC'} ]) \n                        &lt;button id=\"bRefresh\" class=\"btn btn-success btn-sm\" \n                            type=\"button\"&gt;Refresh&lt;\/button&gt;\n                    &lt;\/caption&gt;\n                    &lt;caption id=\"msgBox\" class=\"alert alert-danger hidden\"&gt;&lt;\/caption&gt;\n                    &lt;thead&gt;\n                        &lt;tr&gt;&lt;td&gt;FirstName&lt;\/td&gt;&lt;td&gt;LastName&lt;\/td&gt;&lt;td&gt;Phone&lt;\/td&gt;&lt;\/tr&gt;\n                    &lt;\/thead&gt;\n                    &lt;tbody&gt;&lt;\/tbody&gt;\n                    &lt;tfoot&gt;\n                        &lt;tr&gt;\n                        &lt;td&gt;&lt;input type=\"text\" name=\"FirstName\" id=\"iFirstName\" \n                            placeholder=\"John\" class=\"form-control\" \/&gt;&lt;\/td&gt;\n                        &lt;td&gt;&lt;input type=\"text\" name=\"LastName\" id=\"iLastName\" \n                            placeholder=\"Doe\" class=\"form-control\" \/&gt;&lt;\/td&gt;\n                        &lt;td&gt;\n                            &lt;div class=\"input-group\"&gt;\n                              &lt;input type=\"text\" name=\"Phone\" id=\"iPhone\" \n                                placeholder=\"(123) 456-7890\" class=\"form-control\" \/&gt;\n                              &lt;span class=\"input-group-btn\"&gt;\n                                &lt;button id=\"bAdd\" class=\"btn btn-primary\" \n                                    type=\"button\"&gt;Save&lt;\/button&gt;\n                              &lt;\/span&gt;\n                            &lt;\/div&gt;\n                        &lt;\/td&gt;\n                        &lt;\/tr&gt;\n                    &lt;\/tfoot&gt;\n                &lt;\/table&gt;\n                &lt;div class=\"panel panel-default\"&gt;\n                  &lt;div class=\"panel-heading\"&gt;Log&lt;\/div&gt;\n                  &lt;div class=\"panel-body\" id=\"log\"&gt;\n                  &lt;\/div&gt;\n                &lt;\/div&gt;            \n            &lt;\/div&gt;\n            &lt;div class=\"col-md-2\"&gt;&lt;\/div&gt;\n        &lt;\/div&gt;\n    &lt;\/div&gt;\n\n    &lt;!-- Results template (table rows of Contacts) --&gt;\n    &lt;script id=\"tmpl\" type=\"x-tmpl-mustache\"&gt;\n        &lt;tr&gt;&lt;td&gt;{{FirstName}}&lt;\/td&gt;&lt;td&gt;{{LastName}}&lt;\/td&gt;&lt;td&gt;{{Phone}}&lt;\/td&gt;&lt;\/tr&gt;\n    &lt;\/script&gt;\n\n    &lt;!-- Page functionality --&gt;\n    &lt;script&gt;\n        var table = $('#myTable tbody');\n        var template = $('#tmpl').html();\n        Mustache.parse(template);\n\n        \/\/ Retrieve all contacts and add to results table on page\n        var fetchContacts = function() {\n            (new $M.Contact()).retrieve({\n                orderby: &#91; {LastName: 'ASC'}, {FirstName: 'DESC'} ],\n            }, function(err, records) {\n                if (!err) {\n                    \/\/ Add some status messages to the log panel\n                    $('#log')\n                    .append('&lt;p&gt;Fetched contact records.&lt;\/p&gt;')\n                    .append('&lt;p&gt;Records Size: '+ records.length + '!&lt;\/p&gt;');\n\n                    \/\/ Update the table of contacts with fresh results\n                    table.empty();\n                    records.forEach(function(rec) {\n                        table.append(Mustache.render(template, rec._props));                    \n                    });                \n                } else {\n                    $('#msgBox').text(err.message).removeClass('hidden');            \n                }\n            });\n        };\n        \n        var addContact = function() {\n            \/\/ Create a new Remote Object from form values\n            (new $M.Contact({\n                FirstName: $('#iFirstName').val(),\n                LastName: $('#iLastName').val(),\n                Phone: $('#iPhone').val()\n            })).create(function(err, record, event) {\n                \/\/ New record created...\n                if (!err) {\n                    \/\/ Reset the New Record form fields, for the next create\n                    $('input').each(function() {\n                        $(this).val('');\n                    });\n                    \n                    \/\/ Add some status messages to the log panel\n                    $('#log')\n                    .append('&lt;p&gt;Contact created!&lt;\/p&gt;')\n                    \/\/ Custom data added to event.result by override function\n                    .append('&lt;p&gt;Got custom data: ' + event.result.custom + '&lt;\/p&gt;'); \n\n                    \/\/ Redraw the results list with current contacts\n                    fetchContacts();\n                } else {\n                    $('#msgBox').text(err.message).removeClass('hidden');            \n                }\n            });\n        };\n\n        \/\/ Bind application functions to UI events\n        $('#bRefresh').click(fetchContacts);\n        $('#bAdd').click(addContact);\n        \n        \/\/ Initial load of the contacts list\n        fetchContacts();\n    &lt;\/script&gt;\n&lt;\/apex:page&gt;<\/code><\/pre>\n\n\n\n<p>\u524d\u9762\u793a\u4f8b\u4e2d\u7684\u5173\u952e\u4ee3\u7801\u884c\u4f4d\u4e8e Remote \u5bf9\u8c61\u8bbf\u95ee\u5b9a\u4e49\u3002\u5c06\u5355\u4e2a\u5c5e\u6027\u6dfb\u52a0\u5230\u8054\u7cfb\u4eba\u8fdc\u7a0b\u5bf9\u8c61\u5b9a\u4e49 \u8bbe\u7f6e \u8986\u76d6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>create=\"{!$RemoteAction.RemoteObjectContactOverride.create}\"<\/code><\/pre>\n\n\n\n<p>\u8be5\u5c5e\u6027\u91c7\u7528 \u89c6\u89c9\u529b \u5f15\u7528\u8981\u7528\u4f5c\u5185\u7f6e\u64cd\u4f5c\u91cd\u5199\u7684\u65b9\u6cd5\u7684\u8868\u8fbe\u5f0f\u3002<\/p>\n\n\n\n<p><samp>@RemoteAction<\/samp><samp>create()<\/samp>\u5728\u672c\u4f8b\u4e2d\uff0c\u5f15\u7528\u7684\u65b9\u6cd5\u4f4d\u4e8e Apex \u7c7b\u4e2d\uff0c\u8be5\u7c7b\u662f\u9875\u9762\u7684 \u63a7\u5236\u5668\u3002\u91cd\u5199\u65b9\u6cd5\u7684\u4ee3\u7801\u5f88\u7b80\u5355\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public with sharing class RemoteObjectContactOverride {\n     \n    @RemoteAction\n    public static Map&lt;String, Object&gt; create(String type, Map&lt;String, Object&gt; fields) {\n        System.debug(LoggingLevel.INFO, 'Before calling create on: ' + type);\n        \n        \/\/ Invoke the standard create action\n        \/\/ For when you want mostly-normal behavior, with a little something different\n        Map&lt;String, Object&gt; result = RemoteObjectController.create(type, fields);\n\n        System.debug(LoggingLevel.INFO, 'After calling create on: ' + type);\n        System.debug(LoggingLevel.INFO, 'Result: ' + result);\n        \n        \/\/ Here's the little something different, adding extra data to the result\n        Map&lt;String, Object&gt; customResult = \n            new Map&lt;String, Object&gt; {'custom' =&gt; 'my custom data' };\n        customResult.putAll(result);\n        \n        return customResult;\n    }\n}<\/code><\/pre>\n\n\n\n<p>\u6b64\u65b9\u6cd5\u8bb0\u5f55\u8c03\u7528\uff0c\u7136\u540e \u4f7f\u7528\u6807\u51c6\u8c03\u7528\u6765\u6267\u884c\u521b\u5efa\u3002\u5b83 \u6267\u884c\u76f8\u540c\u7684\u6570\u636e\u64cd\u4f5c\u8bed\u8a00 \uff08DML\uff09 \u547d\u4ee4\u4ee5\u521b\u5efa\u8bb0\u5f55 \u5185\u7f6e\u7248\u672c\u4f1a\uff0c\u56e0\u4e3a\u5b83\u4f7f\u7528\u7684\u662f\u5185\u7f6e\u7248\u672c\u3002\u540e \u6267\u884c create\uff0c\u8be5\u65b9\u6cd5\u4f1a\u6267\u884c\u66f4\u591a\u7684\u65e5\u5fd7\u8bb0\u5f55\u3002\u6700\u540e\uff0c\u5b83\u589e\u52a0\u4e86\u4e00\u4e9b\u989d\u5916\u7684\u5185\u5bb9 \u6570\u636e\u590d\u5236\u5230 JavaScript \u56de\u8c03\u51fd\u6570\u5c06\u63a5\u6536\u7684\u8fd4\u56de\u6709\u6548\u8d1f\u8f7d Visualforce \u9875\u9762\u3002<samp>@RemoteAction<\/samp><samp>RemoteObjectController.create()<\/samp><\/p>\n\n\n\n<p>\u5b83\u6dfb\u52a0\u4e86\u6709\u8da3\u7684\u989d\u5916\u6570\u636e\uff0c\u5e76\u4f7f\u8986\u76d6 \u5185\u7f6e\u65b9\u6cd5\u5f88\u6709\u7528\u3002\u524d\u9762\u7684\u63a7\u5236\u5668\u6dfb\u52a0\u7684\u989d\u5916\u6570\u636e \u662f\u5fae\u4e0d\u8db3\u9053\u7684\uff0c\u4ec5\u7528\u4e8e\u8bf4\u660e\u76ee\u7684\u3002\u5b9e\u9645\u8986\u76d6\u53ef\u4ee5\u5305\u62ec \u66f4\u590d\u6742\u7684\u903b\u8f91 &#8211; \u8ba1\u7b97\u7684\u7ed3\u679c\u3001\u5176\u4ed6\u65b9\u6cd5\u8c03\u7528\u7b49\u3002 \u9700\u8981\u4e86\u89e3\u7684\u91cd\u8981\u4e00\u70b9\u662f\uff0c\u65b0\u7684\u81ea\u5b9a\u4e49\u66ff\u4ee3\u65b9\u6cd5\u53ef\u4ee5\u6267\u884c \u5e55\u540e\u7684\u9644\u52a0\u5185\u5bb9\uff0c\u5e76\u53ef\u4ee5\u8fd4\u56de\u5185\u7f6e\u7248\u672c\u7684\u989d\u5916\u6570\u636e \u4e0d\u80fd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u8fdc\u7a0b\u7684\u793a\u4f8b \u4f7f\u7528 jQuery Mobile \u7684\u5bf9\u8c61<\/h2>\n\n\n\n<p>Visualforce \u8fdc\u7a0b Objects \u65e8\u5728\u4e0e JavaScript \u6846\u67b6\u5f88\u597d\u5730\u201c\u878d\u5408\u201d\u3002\u8fd9\u4e2a\u6269\u5c55\u4f46\u7b80\u5355\u7684\u4f8b\u5b50 \u6f14\u793a\u5982\u4f55\u4f7f\u7528\u8fdc\u7a0b \u4f7f\u7528 jQuery Mobile \u67e5\u770b\u8054\u7cfb\u4eba\u5217\u8868\u4ee5\u53ca\u6dfb\u52a0\u3001\u7f16\u8f91\u548c\u5220\u9664\u7684\u5bf9\u8c61 \u4ed6\u4eec\u3002<\/p>\n\n\n\n<p>\u6b64\u793a\u4f8b\u4f7f\u7528\u00a0Salesforce Mobile Pack\u00a0\u4e2d\u7684 jQuery Mobile\uff0c\u5e76\u4e14\u57fa\u4e8e \u5728\u79fb\u52a8\u968f\u9644\u7684\u793a\u4f8b\u4ee3\u7801\u4e0a \u6253\u5305\u7528\u4e8e jQuery\u3002\u8fdc\u7a0b \u5bf9\u8c61\u548c jQuery Mobile \u53ef\u4ee5\u5f88\u5bb9\u6613\u5730\u4e3a \u7535\u8bdd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5177\u6709\u8fdc\u7a0b\u5bf9\u8c61\u548c jQuery Mobile \u7684\u7b80\u5355\u8054\u7cfb\u4eba\u7f16\u8f91\u5668<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;apex:page docType=\"html-5.0\" showHeader=\"false\" sidebar=\"false\"&gt;          \n\n\t&lt;!-- Include jQuery and jQuery Mobile from the Mobile Pack --&gt;\n    &lt;apex:stylesheet value=\"{!URLFOR($Resource.MobilePack_jQuery, \n         'jquery.mobile-1.3.0.min.css')}\"\/&gt;\n    &lt;apex:includeScript value=\"{!URLFOR($Resource.MobilePack_jQuery, \n         'jquery-1.9.1.min.js')}\"\/&gt;\n    &lt;apex:includeScript value=\"{!URLFOR($Resource.MobilePack_jQuery, \n         'jquery.mobile-1.3.0.min.js')}\"\/&gt;\n\n    &lt;!-- Remote Objects declaration --&gt;\n    &lt;apex:remoteObjects jsNamespace=\"RemoteObjectModel\"&gt;\n        &lt;apex:remoteObjectModel name=\"Contact\" fields=\"Id,FirstName,LastName,Phone\"&gt;\n            &lt;!-- Notes is a custom field added to the Contact object --&gt;\n            &lt;apex:remoteObjectField name=\"Notes__c\" jsShorthand=\"Notes\"\/&gt;\n        &lt;\/apex:remoteObjectModel&gt;\n    &lt;\/apex:remoteObjects&gt;\n\n    &lt;head&gt;\n        &lt;title&gt;Contacts&lt;\/title&gt;\n        &lt;meta name=\"viewport\" \n           content=\"width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no\" \/&gt;\n        \n        &lt;script type=\"text\/javascript\"&gt;\n            var $j = jQuery.noConflict(); \n\n            \/\/ Config object with commonly used data\n            \/\/ This keeps some hard-coded HTML IDs out of the code\n            var Config = {\n                Selectors: {\n                    list: '#cList',\n                    detailFields: \"#fName #lName #phone #notes #error #contactId\".split(\" \")\n                },\n                Data: {\n                    contact: 'contact'\n                }\n            };\n            \n            \/\/ Get all contacts, and display them in a list \n            function getAllContacts() {\n                $j.mobile.showPageLoadingMsg();\n                \n                var c = new RemoteObjectModel.Contact();\n                \/\/ Use the 'limit' operator to increase the default limit of 20\n                c.retrieve({ limit: 100 }, function (err, records) { \n                    \/\/ Handle any errors\n                    if (err) { \n                        displayError(err); \n                    } else {\n                        \/\/ Empty the current list\n                        var list = $j(Config.Selectors.list).empty();\n                        \/\/ Now add results records to list\n                        $j.each(records, function() {\n                            var newLink = $j('&lt;a&gt;&lt;\/a&gt;', {\n                                text: this.get('FirstName') + ' ' + this.get('LastName')\n                            });\n                            newLink.data(Config.Data.contact, this.get('Id'));\n                            newLink.appendTo(list).wrap('&lt;li&gt;&lt;\/li&gt;');\n                        });\n                        \n                        $j.mobile.hidePageLoadingMsg();\n                        list.listview('refresh');\n                    }\n                });\n            }\n\n            \/\/ Handle the Save button that appears on both\n            \/\/ the Edit Contact and New Contact pages\n            function addUpdateContact(e){\n                e.preventDefault();\n\n                var record = new RemoteObjectModel.Contact({\n                    FirstName: $j('#fName').val(),\n                    LastName: $j('#lName').val(),\n                    Phone: $j('#phone').val(),\n                    Notes: $j('#notes').val() \n                    \/\/ Note use of shortcut 'Notes' in place of Notes__c\n                });\n\n                var cId = $j('#contactId').val();\n                if( !cId ) { \/\/ new record\n                    record.create(updateCallback);\n                } else { \/\/ update existing\n                    record.set('Id', cId);\n                    record.update(updateCallback);\n                }\n            }\n            \n            \/\/ Handle the delete button\n            function deleteContact(e){\n                e.preventDefault();\n                var ct = new RemoteObjectModel.Contact();\n                ct.del($j('#contactId').val(), updateCallback);\n            }\n            \n            \/\/ Callback to handle DML Remote Objects calls\n            function updateCallback(err, ids){\n                if (err) { \n                    displayError(err); \n                } else {\n                    \/\/ Reload the contacts with current list\n                    getAllContacts();\n                    $j.mobile.changePage('#listpage', {changeHash: true});\n                }\n            }\n\n            \/\/ Utility function to log and display any errors\n            function displayError(e){\n                console &amp;&amp; console.log(e);\n                $j('#error').html(e.message);\n            }\n        \n            \/\/ Attach functions to the buttons that trigger them\n            function regBtnClickHandlers() {\n                $j('#add').click(function(e) {\n                    e.preventDefault();\n                    $j.mobile.showPageLoadingMsg();\n                    \n                    \/\/ empty all the clic handlers                    \n                    $j.each(Config.Selectors.detailFields, function(i, field) {\n                        $j(field).val('');\n                    });\n                    \n                    $j.mobile.changePage('#detailpage', {changeHash: true});\n                    $j.mobile.hidePageLoadingMsg();\n                });\n        \n                $j('#save').click(function(e) {\n                   addUpdateContact(e);\n                });\n        \n                $j('#delete').click(function(e) {\n                   deleteContact(e);\n                });\n            }\n\n            \/\/ Shows the contact detail view, \n            \/\/ including filling in form fields with current data\n            function showDetailView(contact) {\n                $j('#contactId').val(contact.get('Id'));\n                $j('#fName').val(contact.get('FirstName'));\n                $j('#lName').val(contact.get('LastName'));\n                $j('#phone').val(contact.get('Phone'));\n                $j('#notes').val(contact.get('Notes'));\n                $j('#error').html('');\n                $j.mobile.changePage('#detailpage', {changeHash: true});\n            }\n\n            \/\/ Register click handler for list view clicks\n            \/\/ Note: One click handler handles the whole list\t\n            function regListViewClickHandler() {\n                $j(Config.Selectors.list).on('click', 'li', function(e) {\n\n                    \/\/ show loading message\n                    $j.mobile.showPageLoadingMsg();\n\n                    \/\/ get the contact data for item clicked\n                    var id = $j(e.target).data(Config.Data.contact);\n\n                    \/\/ retrieve latest details for this contact\n                    var c = new RemoteObjectModel.Contact();\n                    c.retrieve({ \n                        where: { Id: { eq: id } } \n                    }, function(err, records) { \n                        if(err) { \n                            displayError(err); \n                        } else {\n                            showDetailView(records&#91;0]);\n                        }\n\n                        \/\/ hide the loading message in either case\n                        $j.mobile.hidePageLoadingMsg();\n                    });\n                });\n            }\n\n            \/\/ And, finally, run the page\n            $j(document).ready(function() {\n                regBtnClickHandlers();\n                regListViewClickHandler();\n                getAllContacts();\n            });\n\n        &lt;\/script&gt;    \n    &lt;\/head&gt;\n\n    &lt;!-- HTML and jQuery Mobile markup for the list and detail screens --&gt;\n    &lt;body&gt;    \n    \n        &lt;!-- This div is the list \"page\" --&gt;\n        &lt;div data-role=\"page\" data-theme=\"b\" id=\"listpage\"&gt;                \n            &lt;div data-role=\"header\" data-position=\"fixed\"&gt;\n                &lt;h2&gt;Contacts&lt;\/h2&gt;\n                &lt;a href='#' id=\"add\" class='ui-btn-right' data-icon='add' \n                   data-theme=\"b\"&gt;Add&lt;\/a&gt;\n            &lt;\/div&gt;\n            &lt;div data-role=\"content\" id=\"contactList\"&gt;            \n                &lt;ul id=\"cList\" data-filter=\"true\" data-inset=\"true\" \n                    data-role=\"listview\" data-theme=\"c\" data-dividertheme=\"b\"&gt;\n                &lt;\/ul&gt;\n            &lt;\/div&gt;\n        &lt;\/div&gt;\n                \n        &lt;!-- This div is the detail \"page\" --&gt;\n        &lt;div data-role=\"page\" data-theme=\"b\" id=\"detailpage\"&gt;\n            &lt;div data-role=\"header\" data-position=\"fixed\"&gt;\n                &lt;a href='#listpage' id=\"back2ContactList\" class='ui-btn-left' \n                   data-icon='arrow-l' data-direction=\"reverse\" \n                   data-transition=\"flip\"&gt;Back&lt;\/a&gt;\n                &lt;h1&gt;Contact Details&lt;\/h1&gt;\n            &lt;\/div&gt;\n            &lt;div data-role=\"content\"&gt;\n                &lt;div data-role=\"fieldcontain\"&gt;\n                    &lt;label for=\"fName\"&gt;First Name:&lt;\/label&gt;\n                    &lt;input name=\"fName\" id=\"fName\" \/&gt;\n                &lt;\/div&gt;\n                &lt;div data-role=\"fieldcontain\"&gt;\n                    &lt;label for=\"lName\"&gt;Last Name:&lt;\/label&gt;\n                    &lt;input name=\"lName\" id=\"lName\" \/&gt;\n                &lt;\/div&gt;\n                &lt;div data-role=\"fieldcontain\"&gt;\n                    &lt;label for=\"phone\"&gt;Phone:&lt;\/label&gt;\n                    &lt;input name=\"phone\" id=\"phone\"\/&gt;\n                &lt;\/div&gt;\n                &lt;div data-role=\"fieldcontain\"&gt;\n                    &lt;label for=\"notes\"&gt;Notes:&lt;\/label&gt;\n                    &lt;textarea name=\"notes\" id=\"notes\"\/&gt;\n                &lt;\/div&gt;\n\n                &lt;h2 style=\"color:red\" id=\"error\"&gt;&lt;\/h2&gt;\n\n                &lt;input type=\"hidden\" id=\"contactId\" \/&gt;\n                &lt;button id=\"save\" data-role=\"button\" data-icon=\"check\" \n                    data-inline=\"true\" data-theme=\"b\" class=\"save\"&gt;Save&lt;\/button&gt;\n                &lt;button id=\"delete\" data-role=\"button\" data-icon=\"delete\" \n                    data-inline=\"true\" class=\"destroy\"&gt;Delete&lt;\/button&gt;\n            &lt;\/div&gt;\n        &lt;\/div&gt;\n    &lt;\/body&gt;\n&lt;\/apex:page&gt;<\/code><\/pre>\n\n\n\n<p>\u8bf7\u6ce8\u610f\uff0c\u867d\u7136\u6240\u6709\u56db\u4e2a\u8fdc\u7a0b \u6f14\u793a\u4e86\u5bf9\u8c61\u64cd\u4f5c\uff0c\u53ea\u6709\u4e09\u4e2a\u56de\u8c03\u5904\u7406\u7a0b\u5e8f\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><samp>getAllContacts()<\/samp>\u52a0\u8f7d\u8054\u7cfb\u4eba\u5217\u8868\u7684\u8c03\u7528 \u5e76\u4e3a\u56de\u8c03\u63d0\u4f9b\u533f\u540d\u51fd\u6570\u3002\u56de\u8c03\u68c0\u67e5 \u9519\u8bef\uff0c\u7136\u540e\u5faa\u73af\u8bbf\u95ee\u7ed3\u679c\uff0c\u5c06\u5b83\u4eec\u6dfb\u52a0\u5230\u9875\u9762\u4e2d\u3002<samp>retrieve()<\/samp><\/li>\n\n\n\n<li>\u540c\u6837\uff0c\u8c03\u7528\u52a0\u8f7d\u5355\u4e2a \u8054\u7cfb\u8be6\u60c5\u9875\u9762\uff0c\u7ed3\u679c\u4e5f\u7531 \u533f\u540d\u51fd\u6570\u3002<samp>showDetailView()<\/samp><samp>retrieve()<\/samp><\/li>\n\n\n\n<li><samp>addUpdateContact()<\/samp>\u5e76\u5904\u7406\u6dfb\u52a0\uff0c \u66f4\u65b0\u548c\u5220\u9664\u8054\u7cfb\u4eba\u3002\u8fd9\u4e24\u79cd\u65b9\u6cd5\u90fd\u4f5c\u4e3a\u56de\u8c03\u4f20\u9012 \u529f\u80fd\u3002 \u4e0d\u4f7f\u7528\u8fdc\u7a0b\u7684\u7ed3\u679c \u5bf9\u8c61\u64cd\u4f5c\u3002\u5b83\u53ea\u68c0\u67e5\u9519\u8bef\uff0c\u5c06\u5b83\u4eec\u8bb0\u5f55\u5230\u63a7\u5236\u53f0\uff0c\u7136\u540e \u8c03\u7528\u5237\u65b0 \u9875\u9762\u3002<samp>deleteContact()updateCallback()updateCallback()getAllContacts()<\/samp><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u4f7f\u7528\u8fdc\u7a0b\u7684\u6700\u4f73\u5b9e\u8df5 \u5bf9\u8c61<\/h2>\n\n\n\n<p>Visualforce \u8fdc\u7a0bObjects \u662f\u4e00\u4e2a\u6709\u6548\u7684\u5de5\u5177\uff0c\u7528\u4e8e\u5feb\u901f\u5411 Visualforce \u9875\u9762\u6dfb\u52a0\u7b80\u5355\u7684\u6570\u636e\u64cd\u4f5c\u3002\u8fdc\u7a0b Objects \u6613\u4e8e\u4f7f\u7528\uff0c\u5177\u6709\u4e0d\u9700\u8981 Apex \u4ee3\u7801\u5373\u53ef\u5b9e\u73b0\u8bfb\u53d6\u7684\u8f7b\u91cf\u7ea7\u7ec4\u4ef6 \u4ee5\u53ca\u5c06\u6570\u636e\u5199\u5165 Salesforce \u670d\u52a1\u3002\u8fdc\u7a0b \u4f46\u662f\uff0c\u5bf9\u8c61\u5e76\u4e0d\u603b\u662f\u9002\u5408\u8fd9\u9879\u5de5\u4f5c\u7684\u5de5\u5177\uff0c\u56e0\u6b64\u4e86\u89e3\u8fdc\u7a0b\u64cd\u4f5c\u975e\u5e38\u91cd\u8981 \u5bf9\u8c61\u7684\u5de5\u4f5c\u539f\u7406\u4ee5\u53ca\u4f55\u65f6\u4f7f\u7528\u5176\u4ed6\u5de5\u5177\uff0c\u4f8b\u5982 JavaScript \u8fdc\u7a0b\u5904\u7406\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u5b57\u6bb5\u7ea7\u5b89\u5168\u6027<\/h2>\n\n\n\n<p>\u8fdc\u7a0b \u5bf9\u8c61\u9075\u5faa\u7ec4\u7ec7\u7684\u5b57\u6bb5\u7ea7\u522b\u5b89\u5168\u8bbe\u7f6e\u3002\u521b\u5efa\u65f6\u8bf7\u8bb0\u4f4f\u8fd9\u4e00\u70b9 \u4f7f\u7528\u8fdc\u7a0b\u7684\u9875\u9762 \u5bf9\u8c61\u3002\u67e5\u770b\u9875\u9762\u7684\u7528\u6237\u65e0\u6cd5\u8bbf\u95ee\u7684\u5b57\u6bb5\u663e\u793a\u4e3a\u7a7a\u767d\u3002\u64cd\u4f5c \u5982\u679c\u4fee\u6539\u5b57\u6bb5\u6570\u636e \uff08\uff0c \uff0c \u548c \uff09 \u5728\u8bf7\u6c42\u4e2d\u5305\u542b\u4e0d\u53ef\u8bbf\u95ee\u7684\u5b57\u6bb5\uff0c\u5219\u5b83\u4eec\u5c06\u5931\u8d25\u5e76\u663e\u793a\u9519\u8bef\u3002<samp>create()<\/samp><samp>update()<\/samp><samp>upsert()<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ea4\u6613\u8fb9\u754c<\/h2>\n\n\n\n<p><samp>)<\/samp><\/p>\n\n\n\n<p>\u76f8\u6bd4\u4e4b\u4e0b\uff0cJavaScript \u8fdc\u7a0b\u5904\u7406\u4e8b\u52a1 \u8fb9\u754c\u4f4d\u4e8e Apex \u65b9\u6cd5\u4e0a\u3002\u5b83 \u5728\u4e00\u79cd\u65b9\u6cd5\u4e2d\u8f7b\u677e\u521b\u5efa\u53d1\u7968\u548c\u76f8\u5173\u884c\u9879\u76ee\u8bb0\u5f55\uff0c\u5176\u4e2d\u81ea\u52a8 Apex \u4ea4\u6613\u53ef\u786e\u4fdd\u6240\u6709 \u8bb0\u5f55\u662f\u4e00\u8d77\u521b\u5efa\u7684\uff0c\u6216\u8005\u6839\u672c\u4e0d\u521b\u5efa\u3002<samp>@RemoteAction<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u4e1a\u52a1\u903b\u8f91\u7684\u9002\u5f53\u653e\u7f6e\u548c\u6d4b\u8bd5<\/h2>\n\n\n\n<p>\u4ed4\u7ec6\u8003\u8651\u5c06\u5e94\u7528\u7a0b\u5e8f\u7684\u4e1a\u52a1\u903b\u8f91\u653e\u5728\u4f55\u5904\uff0c\u5c24\u5176\u662f\u5728 \u8fd9\u5f88\u590d\u6742\u3002\u5f53\u60a8\u521b\u5efa\u652f\u6301\u521b\u5efa\u3001\u7f16\u8f91\u548c \u5220\u9664\u5355\u4e2a\u5bf9\u8c61\uff0c\u5982\u4f7f\u7528 Remote \u7684\u793a\u4f8b \u4f7f\u7528 jQuery Mobile \u7684\u5bf9\u8c61\uff0c\u4e1a\u52a1\u903b\u8f91\u662f\u6700\u5c0f\u7684\u3002\u5c06\u6b64\u4e1a\u52a1\u903b\u8f91\u653e\u5728\u5ba2\u6237\u7aef\uff0c\u5728 \u8fdc\u7a0b \u5bf9\u8c61\u548c JavaScript\uff0c\u53ef\u4ee5\u5b8c\u5168\u5408\u9002\u3002\u5f53\u60a8\u6709\u66f4\u590d\u6742\u7684\u4e1a\u52a1\u89c4\u5219\u548c \u4f46\u662f\uff0c\u4ece\u5ba2\u6237\u7aef\u5c42\u4e2d\u5220\u9664\u8be5\u903b\u8f91\u53ef\u80fd\u66f4\u6709\u6548\uff0c\u5e76\u4e14 \u5728\u670d\u52a1\u5668\u7aef\u6784\u5efa\u5b83\u3002\u5728\u51b3\u5b9a\u5c06\u7ec4\u7ec7\u7684\u4e1a\u52a1\u903b\u8f91\u653e\u5728\u4f55\u5904\u65f6\uff0c\u8bf7\u8003\u8651\u4ee5\u4e0b\u51e0\u70b9\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5b89\u5168\u6027\u548c\u4e00\u81f4\u6027\uff1a\u8bf7\u8bb0\u4f4f\uff0c\u7528\u6237\u53ef\u80fd\u4f1a\u5728 \u5728\u4e8b\u52a1\u4e2d\uff0c\u6216\u8005\u6539\u53d8\u9875\u9762\u7684 JavaScript \u4f7f\u7528 Firebug \u548c\u5176\u4ed6 \u5de5\u5177\u3002\u8fdc\u7a0b \u5bf9\u8c61\u5f3a\u5236\u6267\u884c\u9a8c\u8bc1\u89c4\u5219\u3001\u89e6\u53d1\u5668\u3001\u5171\u4eab\u89c4\u5219\u3001\u5b57\u6bb5\u7ea7\u5b89\u5168\u6027\u7b49 \u6570\u636e\u8bbf\u95ee\u9650\u5236\uff0c\u4f46\u5982\u679c\u60a8\u5c06\u4e1a\u52a1\u89c4\u5219\u653e\u5728 JavaScript \u800c\u4e0d\u662f Salesforce \u4e2d\uff0c\u8fd9\u4e9b\u89c4\u5219\u53ef\u80fd\u4f1a\u88ab\u4e2d\u65ad\uff0c \u66f4\u6539\u6216\u7ed5\u8fc7\u3002<\/li>\n\n\n\n<li>\u53ef\u6d4b\u8bd5\u6027\uff1a\u670d\u52a1\u5668\u7aef\u7684\u4e1a\u52a1\u903b\u8f91\u53ef\u4ee5\u4f7f\u7528 Salesforce \u63d0\u4f9b\u7684\u8bb8\u591a\u5de5\u5177\u8fdb\u884c\u6d4b\u8bd5\u3002\u4e3a \u56e0\u6b64\uff0c\u6211\u4eec\u9f13\u52b1\u60a8\u5c06\u590d\u6742\u7684\u884c\u4e3a\u653e\u5728 Apex \u4e2d\uff0c\u5e76\u4f7f\u7528 Apex \u6d4b\u8bd5\u6846\u67b6 \u4ee5\u9a8c\u8bc1\u5b83\u662f\u5426\u6309\u9884\u671f\u5de5\u4f5c\u3002<\/li>\n\n\n\n<li>\u6027\u80fd\uff1a\u5982\u679c\u60a8\u7684\u5904\u7406\u9700\u8981\u5c06\u8bb8\u591a\u8bb0\u5f55\u4f5c\u4e3a\u4e8b\u52a1\u7684\u4e00\u90e8\u5206\u8fdb\u884c\u67e5\u770b\uff0c\u4f46 \u4e0d\u4f1a\u5728\u6d4f\u89c8\u5668\u4e2d\u663e\u793a\u5b83\u4eec\uff0c\u6211\u4eec\u5efa\u8bae\u60a8\u907f\u514d\u5c06\u8be5\u6570\u636e\u53d1\u9001\u5230\u5ba2\u6237\u7aef\uff0c\u5e76\u4e14 \u800c\u662f\u5728\u670d\u52a1\u5668\u4e0a\u201c\u672c\u5730\u201d\u5904\u7406\u6570\u636e\u3002\u60f3\u60f3\u4f60\u7684\u9875\u9762\u9700\u8981\u505a\u4ec0\u4e48\u6570\u636e \u5b83\u7684\u5de5\u4f5c\uff0c\u5e76\u786e\u4fdd\u60a8\u4e0d\u4f1a\u4e0d\u5fc5\u8981\u5730\u901a\u8fc7\u7f51\u7edc\u590d\u5236\u5b83\u3002<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">\u5904\u7406\u590d\u6742\u6027<\/h2>\n\n\n\n<p>\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u4ed4\u7ec6\u7ba1\u7406\u590d\u6742\u6027\u3002\u7b80\u5355\u7684\u8054\u7cfb\u4eba\u7ba1\u7406\u5668\u6216\u5546\u5e97\u5b9a\u4f4d\u5668 \u9875\u9762\u7ba1\u7406\u8d77\u6765\u5e76\u4e0d\u590d\u6742\uff0c\u4f46\u8bb8\u591a\u4e1a\u52a1\u6d41\u7a0b\u90fd\u6709\u3002 \u8fdc\u7a0b \u5bf9\u8c61\u4e0e jQuery \u548c AngularJS \u7b49 JavaScript \u6846\u67b6\u642d\u914d\u5f97\u5f88\u597d\uff0c\u8fd9\u4e9b\u6846\u67b6\u53ef\u4ee5\u5e2e\u52a9 \u5e94\u7528\u7a0b\u5e8f\u7528\u6237\u754c\u9762\u7684\u590d\u6742\u6027\u3002\u59cb\u7ec8\u8003\u8651\u5c06\u5173\u6ce8\u70b9\u5206\u5f00 \u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u5206\u4e3a\u591a\u4e2a\u5c42\uff0c\u5e76\u5c3d\u53ef\u80fd\u4f7f\u5b83\u4eec\u79bb\u6563\u3002\u8fd9\u79f0\u4e3a \u201c\u5173\u6ce8\u70b9\u5206\u79bb\u201d\uff0c\u8fd9\u662f\u4e00\u79cd\u7ecf\u5178\u7684\u8f6f\u4ef6\u6a21\u5f0f\u548c\u6700\u4f73\u5b9e\u8df5\u3002<\/p>\n\n\n\n<p>\u8bf7\u8003\u8651\u5c06\u6570\u636e\u5b8c\u6574\u6027\u89c4\u5219\u653e\u5728\u89e6\u53d1\u5668\u548c\u9a8c\u8bc1\u89c4\u5219\u4e2d\u3002\u8fd8\u8981\u8003\u8651 \u5c06\u4e1a\u52a1\u6d41\u7a0b\u89c4\u5219\u5c01\u88c5\u5728 Apex \u4ee3\u7801\u4e2d\uff0c\u60a8\u53ef\u4ee5\u901a\u8fc7\u53ef\u4e0e JavaScript \u8fdc\u7a0b\u5904\u7406\u6216 SOAP \u6216 REST \u670d\u52a1\u4e00\u8d77\u4f7f\u7528\u7684\u65b9\u6cd5\u8bbf\u95ee\u8fd9\u4e9b\u89c4\u5219 \u60a8\u53ef\u4ee5\u5728\u4efb\u4f55\u5730\u65b9\u4f7f\u7528\u3002<samp>@RemoteAction<\/samp><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fdc\u7a0b\u7684\u66ff\u4ee3\u54c1 \u5bf9\u8c61<\/h2>\n\n\n\n<p>\u8fdc\u7a0b Objects \u662f\u4e00\u4e2a\u6709\u7528\u7684\u5de5\u5177\uff0c\u7528\u4e8e\u5feb\u901f\u521b\u5efa\u5177\u6709\u57fa\u672c\u6570\u636e\u64cd\u4f5c\u7684\u9875\u9762\u3002\u5f53\u5de5\u4f5c\u90a3 \u60a8\u7684\u9875\u9762\u9700\u8981\u505a\u7684\u6bd4\u8fd9\u66f4\u5927\uff0c\u8003\u8651\u5230 Salesforce \u63d0\u4f9b\u4e86\u8bb8\u591a\u66ff\u4ee3\u65b9\u6848 \u95ea\u7535\u5e73\u53f0\u5f00\u53d1\u4eba\u5458\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u6807\u51c6 Visualforce \u53ef\u7528\u4e8e\u5b9e\u73b0\u5e7f\u6cdb\u7684\u5e94\u7528\u7a0b\u5e8f\u529f\u80fd\u3002 Visualforce \u5728\u4f7f\u7528\u6807\u51c6\u63a7\u5236\u5668\u65f6\u63d0\u4f9b\u4e86\u8bb8\u591a\u81ea\u52a8\u529f\u80fd\uff0c\u5e76\u4e14 \u4f7f\u7528\u60a8\u81ea\u5df1\u7684 Apex \u4ee3\u7801\u652f\u6301\u5b8c\u5168\u81ea\u5b9a\u4e49\u7684\u529f\u80fd\u3002<\/li>\n\n\n\n<li>JavaScript \u8fdc\u7a0b\u5904\u7406\u4e5f\u9002\u7528\u4e8e \u7b2c\u4e09\u65b9 JavaScript \u6846\u67b6\uff0c\u4f7f\u60a8\u80fd\u591f\u8bbf\u95ee \u9876\u70b9\u3002<\/li>\n\n\n\n<li>Salesforce Mobile \u5141\u8bb8\u60a8\u4f7f\u7528 \u58f0\u660e\u6027\u5de5\u5177\uff0c\u800c\u4e0d\u662f\u4ee3\u7801\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4ed4\u7ec6\u8003\u8651\u60a8\u7684\u9875\u9762\u6216\u5e94\u7528\u7a0b\u5e8f\u9700\u8981\u505a\u4ec0\u4e48\uff0c\u7136\u540e\u9009\u62e9\u6b63\u786e\u7684 \u5de5\u4f5c\u5de5\u5177\u3002\u6709\u65f6\u8be5\u5de5\u5177\u662f\u8fdc\u7a0b\u7684 \u5bf9\u8c61\uff0c\u6709\u65f6\u662f\u522b\u7684\u4e1c\u897f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8fdc\u7a0b \u5bf9\u8c61\u9650\u5236<\/h2>\n\n\n\n<p>Visualforce \u867d\u7136\u8fdc\u7a0b \u5bf9\u8c61\u4e0d\u53d7\u67d0\u4e9b\u8d44\u6e90\u9650\u5236\u7684\u7ea6\u675f\uff0c\u5b83\u6709\u81ea\u5df1\u7684\u9650\u5236\u3002\u8fdc\u7a0b \u5bf9\u8c61\u53d7\u4ee5\u4e0b\u9650\u5236\u7684\u7ea6\u675f\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u8fdc\u7a0b \u5bf9\u8c61\u4e0d\u662f\u89c4\u907f Salesforce \u670d\u52a1\u9650\u5236\u7684\u65b9\u6cd5\u3002\u8fdc\u7a0b \u5bf9\u8c61\u8c03\u7528\u4e0d\u53d7 API \u9650\u5236\u7684\u7ea6\u675f\uff0c\u4f46\u4f7f\u7528\u8fdc\u7a0b\u7684 Visualforce \u9875\u9762\u4e0d\u53d7\u9650\u5236 \u5bf9\u8c61\u53d7\u6240\u6709\u6807\u51c6 Visualforce \u9650\u5236\u7684\u7ea6\u675f\u3002<\/li>\n\n\n\n<li>\u5728\u5355\u4e2a\u8bf7\u6c42\u4e2d\u6700\u591a\u53ef\u4ee5\u68c0\u7d22 100 \u884c\u3002\u8981\u663e\u793a\u66f4\u591a\u884c\uff0c\u8bf7\u63d0\u4ea4 \u4f7f\u7528\u67e5\u8be2\u7684\u5176\u4ed6\u8bf7\u6c42 \u53c2\u6570\u3002<samp>OFFSET<\/samp><\/li>\n\n\n\n<li>\u8fdc\u7a0b \u5bf9\u8c61\u4e0d\u652f\u6301\u5b57\u6bb5\u3002\u60a8\u65e0\u6cd5\u68c0\u7d22 \u6216\u8bbe\u7f6e \u7c7b\u578b\u4e3a \u7684\u5bf9\u8c61\u5b57\u6bb5\u7684\u503c\u3002<samp>Blob<\/samp><samp>Blob<\/samp><\/li>\n\n\n\n<li>\u5c06\u5c5e\u6027\u8bbe\u7f6e\u4e3a\u201c\u8fdc\u7a0b\u201d \u5bf9\u8c61\u7ec4\u4ef6\u7981\u7528\u4e3a\u90a3\u4e9b Remote \u751f\u6210 JavaScript \u5bf9\u8c61\u3002\u4f9d\u8d56\u4e8e\u672a\u5448\u73b0\u7684 Remote \u7684\u4efb\u4f55\u9875\u9762\u529f\u80fd \u8fd8\u5e94\u7981\u7528\u5bf9\u8c61\u3002<samp>rendered<\/samp><samp>false<\/samp><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b\u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002<\/p>\n","protected":false},"author":1,"featured_media":4149,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[271],"tags":[297],"class_list":["post-4148","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-visualforce-","tag-visualforce-"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Visualforce \u8fdc\u7a0b\u5bf9\u8c61 - \u767d\u767d\u968f\u7b14<\/title>\n<meta name=\"description\" content=\"JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b\u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.ponybai.com\/?p=4148\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Visualforce \u8fdc\u7a0b\u5bf9\u8c61 - \u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"og:description\" content=\"JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b\u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.ponybai.com\/?p=4148\" \/>\n<meta property=\"og:site_name\" content=\"\u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-29T06:37:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-06T06:42:01+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/12\/remote.png\" \/>\n\t<meta property=\"og:image:width\" content=\"855\" \/>\n\t<meta property=\"og:image:height\" content=\"411\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"ponybai\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"ponybai\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.ponybai.com\/?p=4148#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=4148\"},\"author\":{\"name\":\"ponybai\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"headline\":\"Visualforce \u8fdc\u7a0b\u5bf9\u8c61\",\"datePublished\":\"2024-02-29T06:37:57+00:00\",\"dateModified\":\"2023-12-06T06:42:01+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=4148\"},\"wordCount\":382,\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"keywords\":[\"Visualforce \u8fdc\u7a0b\u5bf9\u8c61\"],\"articleSection\":[\"Visualforce \u5f00\u53d1\u4eba\u5458\u6307\u5357\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.ponybai.com\/?p=4148\",\"url\":\"http:\/\/www.ponybai.com\/?p=4148\",\"name\":\"Visualforce \u8fdc\u7a0b\u5bf9\u8c61 - \u767d\u767d\u968f\u7b14\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/#website\"},\"datePublished\":\"2024-02-29T06:37:57+00:00\",\"dateModified\":\"2023-12-06T06:42:01+00:00\",\"description\":\"JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b\u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002\",\"breadcrumb\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=4148#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.ponybai.com\/?p=4148\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.ponybai.com\/?p=4148#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.ponybai.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Visualforce \u8fdc\u7a0b\u5bf9\u8c61\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.ponybai.com\/#website\",\"url\":\"http:\/\/www.ponybai.com\/\",\"name\":\"\u767d\u767d\u968f\u7b14\",\"description\":\"Salesforce\u5b98\u65b9\u8bb2\u5e08\",\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.ponybai.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\",\"name\":\"ponybai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"contentUrl\":\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg\",\"width\":248,\"height\":248,\"caption\":\"ponybai\"},\"logo\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"http:\/\/121.37.188.161\"],\"url\":\"http:\/\/www.ponybai.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Visualforce \u8fdc\u7a0b\u5bf9\u8c61 - \u767d\u767d\u968f\u7b14","description":"JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b\u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.ponybai.com\/?p=4148","og_locale":"zh_CN","og_type":"article","og_title":"Visualforce \u8fdc\u7a0b\u5bf9\u8c61 - \u767d\u767d\u968f\u7b14","og_description":"JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b\u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002","og_url":"http:\/\/www.ponybai.com\/?p=4148","og_site_name":"\u767d\u767d\u968f\u7b14","article_published_time":"2024-02-29T06:37:57+00:00","article_modified_time":"2023-12-06T06:42:01+00:00","og_image":[{"width":855,"height":411,"url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/12\/remote.png","type":"image\/png"}],"author":"ponybai","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"ponybai","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"6 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.ponybai.com\/?p=4148#article","isPartOf":{"@id":"http:\/\/www.ponybai.com\/?p=4148"},"author":{"name":"ponybai","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"headline":"Visualforce \u8fdc\u7a0b\u5bf9\u8c61","datePublished":"2024-02-29T06:37:57+00:00","dateModified":"2023-12-06T06:42:01+00:00","mainEntityOfPage":{"@id":"http:\/\/www.ponybai.com\/?p=4148"},"wordCount":382,"publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"keywords":["Visualforce \u8fdc\u7a0b\u5bf9\u8c61"],"articleSection":["Visualforce \u5f00\u53d1\u4eba\u5458\u6307\u5357"],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/www.ponybai.com\/?p=4148","url":"http:\/\/www.ponybai.com\/?p=4148","name":"Visualforce \u8fdc\u7a0b\u5bf9\u8c61 - \u767d\u767d\u968f\u7b14","isPartOf":{"@id":"http:\/\/www.ponybai.com\/#website"},"datePublished":"2024-02-29T06:37:57+00:00","dateModified":"2023-12-06T06:42:01+00:00","description":"JavaScript \u8fdc\u7a0b\u5904\u7406\u662f\u4e00\u79cd\u5e38\u7528\u3001\u529f\u80fd\u5f3a\u5927\u4e14\u9ad8\u6548\u7684 Web \u5e94\u7528\u7a0b\u5e8f\u6784\u5efa\u65b9\u6cd5 \u4f7f\u7528 Visualforce\uff0c\u7279\u522b\u662f\u7528\u4e8e\u521b\u5efa\u7528\u4e8e Salesforce \u79fb\u52a8\u5e94\u7528\u7a0b\u5e8f\u6216\u5de5\u4f5c\u7684\u9875\u9762 \u4f7f\u7528 JavaScript \u5e93\uff0c\u4f8b\u5982 jQuery \u6216 AngularJS\u3002Visualforce \u8fdc\u7a0b\u5bf9\u8c61\u662f\u542f\u7528 \u76f4\u63a5\u4ece JavaScript \u5bf9 sObject \u6267\u884c\u57fa\u672c DML \u64cd\u4f5c\u3002\u8fdc\u7a0b \u5bf9\u8c61\u6d88\u9664\u4e86\u4e00\u4e9b\u590d\u6742\u6027 \u901a\u8fc7\u51cf\u5c11\u5bf9 Apex \u63a7\u5236\u5668\u6216\u6269\u5c55\u4e2d\u65b9\u6cd5\u7684\u9700\u6c42\uff0c\u4ece JavaScript \u8fdc\u7a0b\u5904\u7406\u3002","breadcrumb":{"@id":"http:\/\/www.ponybai.com\/?p=4148#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.ponybai.com\/?p=4148"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.ponybai.com\/?p=4148#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.ponybai.com\/"},{"@type":"ListItem","position":2,"name":"Visualforce \u8fdc\u7a0b\u5bf9\u8c61"}]},{"@type":"WebSite","@id":"http:\/\/www.ponybai.com\/#website","url":"http:\/\/www.ponybai.com\/","name":"\u767d\u767d\u968f\u7b14","description":"Salesforce\u5b98\u65b9\u8bb2\u5e08","publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.ponybai.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883","name":"ponybai","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/","url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","contentUrl":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2025\/03\/cropped-Ihsans-WeChatQR.jpg","width":248,"height":248,"caption":"ponybai"},"logo":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/image\/"},"sameAs":["http:\/\/121.37.188.161"],"url":"http:\/\/www.ponybai.com\/?author=1"}]}},"_links":{"self":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/4148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4148"}],"version-history":[{"count":2,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/4148\/revisions"}],"predecessor-version":[{"id":4152,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/4148\/revisions\/4152"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/media\/4149"}],"wp:attachment":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4148"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}