{"id":851,"date":"2018-01-29T13:13:48","date_gmt":"2018-01-29T05:13:48","guid":{"rendered":"http:\/\/www.ponybai.com\/?p=851"},"modified":"2018-01-29T13:13:48","modified_gmt":"2018-01-29T05:13:48","slug":"visualforce-%e9%82%ae%e4%bb%b6%e6%a8%a1%e6%9d%bf%ef%bc%884%ef%bc%89%e6%8e%a7%e5%88%b6%e5%99%a8","status":"publish","type":"post","link":"http:\/\/www.ponybai.com\/?p=851","title":{"rendered":"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668"},"content":{"rendered":"<p>\t\t\t\tVisualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u53ef\u4ee5\u5229\u7528\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u5448\u73b0\u9ad8\u5ea6\u81ea\u5b9a\u4e49\u7684\u5185\u5bb9\u4e3a\u6b64\uff0c\u8bf7\u5728\u4f7f\u7528\u8be5\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u7684Visualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u4e2d\u5305\u542b\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u3002<br \/>\n\u4f8b\u5982\uff0c\u5047\u8bbe\u60a8\u60f3\u5728\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u4e2d\u663e\u793a\u4ee5\u5355\u8bcd\u201cSmith\u201d\u5f00\u5934\u7684\u6240\u6709\u5e10\u6237\u7684\u5217\u8868\u3002\u4e3a\u6b64\uff0c\u9996\u5148\u7f16\u5199\u4e00\u4e2a\u4f7f\u7528SOSL\u8c03\u7528\u7684\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\uff0c\u4ee5\u8fd4\u56de\u4ee5\u201cSmith\u201d\u5f00\u5934\u7684\u5e10\u6237\u5217\u8868\uff1a<\/p>\n<p style=\"padding-left: 30px;\">public class findSmithAccounts {<br \/>\nprivate final List&lt;Account&gt; accounts;<br \/>\npublic findSmithAccounts() {<br \/>\naccounts = [select Name from Account where Name LIKE &#8216;Smith_%&#8217;];<br \/>\n}<br \/>\npublic List&lt;Account&gt; getSmithAccounts() {<br \/>\nreturn accounts;<br \/>\n}<br \/>\n}<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u521b\u5efa\u4e00\u4e2a\u540d\u4e3asmithAccounts\u7684\u81ea\u5b9a\u4e49\u7ec4\u4ef6\uff0c\u8be5\u7ec4\u4ef6\u4f7f\u7528\u6b64\u63a7\u5236\u5668\uff1a<\/p>\n<p style=\"padding-left: 30px;\">&lt;apex:component controller=&#8221;findSmithAccounts&#8221; access=&#8221;global&#8221;&gt;<br \/>\n&lt;apex:dataTable value=&#8221;{!SmithAccounts}&#8221; var=&#8221;s_account&#8221;&gt;<br \/>\n&lt;apex:column&gt;<br \/>\n&lt;apex:facet name=&#8221;header&#8221;&gt;Account Name&lt;\/apex:facet&gt;<br \/>\n{!s_account.Name}<br \/>\n&lt;\/apex:column&gt;<br \/>\n&lt;\/apex:dataTable&gt;<br \/>\n&lt;\/apex:component&gt;<\/p>\n<p>\u63d0\u793a\uff1a\u8bf7\u8bb0\u4f4f\uff0cVisualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u4e2d\u4f7f\u7528\u7684\u6240\u6709\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u5fc5\u987b\u5177\u6709\u5168\u5c40\u8bbf\u95ee\u7ea7\u522b\u3002<br \/>\n\u6700\u540e\uff0c\u521b\u5efa\u4e00\u4e2a\u5305\u542bsmithAccounts\u7ec4\u4ef6\u7684Visualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\uff1a<\/p>\n<p style=\"padding-left: 30px;\">&lt;messaging:emailTemplate subject=&#8221;Embedding Apex Code&#8221; recipientType=&#8221;Contact&#8221;<br \/>\nrelatedToType=&#8221;Opportunity&#8221;&gt;<br \/>\n&lt;messaging:htmlEmailBody&gt;<br \/>\n&lt;p&gt;As you requested, here&#8217;s a list of all our Smith accounts:&lt;\/p&gt;<br \/>\n&lt;c:smithAccounts\/&gt;<br \/>\n&lt;p&gt;Hope this helps with the {!relatedToType}.&lt;\/p&gt;<br \/>\n&lt;\/messaging:htmlEmailBody&gt;<br \/>\n&lt;\/messaging:emailTemplate&gt;<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u5c3d\u7ba1emailTemplate\u7ec4\u4ef6\u9700\u8981relatedToType\u5c5e\u6027\uff0c\u4f46\u5b83\u5bf9\u6b64\u793a\u4f8b\u6ca1\u6709\u4efb\u4f55\u5f71\u54cd\u3002\u5b83\u5177\u6709\u201c\u673a\u4f1a\u201d\u7684\u4ef7\u503c\u53ea\u662f\u4e3a\u4e86\u8868\u660e\u5b83\u53ef\u4ee5\u91c7\u7528\u4e0e\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u4e2d\u4f7f\u7528\u7684\u5bf9\u8c61\u4e0d\u540c\u7684\u5bf9\u8c61\u503c\u3002<\/p>\n<p>\u6ce8\u610f\uff1a<\/p>\n<p>\u5982\u679c\u60a8\u7684\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u4f7f\u7528\u6807\u51c6\u63a7\u5236\u5668\uff0c\u5219\u5f3a\u5236\u5171\u4eab\u8bbe\u7f6e\u3002\u5982\u679c\u7528\u6237\u5bf9\u8c61\u7684\u7ec4\u7ec7\u8303\u56f4\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a\u201c\u79c1\u4eba\u201d\uff0c\u5e76\u4e14\u60a8\u9700\u8981\u8bbf\u95eeVisualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u4e2d\u7684\u7528\u6237\u4fe1\u606f\uff08\u5982\u59d3\u540d\u548c\u7535\u5b50\u90ae\u4ef6\u5730\u5740\uff09\uff0c\u5219\u53ef\u4ee5\u4f7f\u7528\u5e26\u6709\u4e0d\u5171\u4eab\u5173\u952e\u5b57\u7684\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u6216\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u3002<br \/>\n\u6709\u5173\u5171\u4eab\u7528\u6237\u5bf9\u8c61\u7684\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605Salesforce\u8054\u673a\u5e2e\u52a9\u4e2d\u7684\u7528\u6237\u5171\u4eab\u6982\u8ff0\u3002\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Visualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u53ef\u4ee5\u5229\u7528\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u5448\u73b0\u9ad8\u5ea6\u81ea\u5b9a\u4e49\u7684\u5185\u5bb9\u4e3a\u6b64\uff0c\u8bf7\u5728\u4f7f\u7528\u8be5\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u7684Vis &hellip; <a href=\"http:\/\/www.ponybai.com\/?p=851\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[91],"tags":[],"class_list":["post-851","post","type-post","status-publish","format-standard","hentry","category-visualforce-"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668 - \u767d\u767d\u968f\u7b14<\/title>\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=851\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668 - \u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"og:description\" content=\"Visualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u53ef\u4ee5\u5229\u7528\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u5448\u73b0\u9ad8\u5ea6\u81ea\u5b9a\u4e49\u7684\u5185\u5bb9\u4e3a\u6b64\uff0c\u8bf7\u5728\u4f7f\u7528\u8be5\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u7684Vis &hellip; \u7ee7\u7eed\u9605\u8bfbVisualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.ponybai.com\/?p=851\" \/>\n<meta property=\"og:site_name\" content=\"\u767d\u767d\u968f\u7b14\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-29T05:13:48+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/11\/cropped-weixin2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"248\" \/>\n\t<meta property=\"og:image:height\" content=\"248\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\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=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/www.ponybai.com\/?p=851#article\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=851\"},\"author\":{\"name\":\"ponybai\",\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"headline\":\"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668\",\"datePublished\":\"2018-01-29T05:13:48+00:00\",\"dateModified\":\"2018-01-29T05:13:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=851\"},\"wordCount\":149,\"publisher\":{\"@id\":\"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883\"},\"articleSection\":[\"Visualforce-\u90ae\u4ef6\u6a21\u677f\"],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.ponybai.com\/?p=851\",\"url\":\"http:\/\/www.ponybai.com\/?p=851\",\"name\":\"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668 - \u767d\u767d\u968f\u7b14\",\"isPartOf\":{\"@id\":\"http:\/\/www.ponybai.com\/#website\"},\"datePublished\":\"2018-01-29T05:13:48+00:00\",\"dateModified\":\"2018-01-29T05:13:48+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/www.ponybai.com\/?p=851#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.ponybai.com\/?p=851\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.ponybai.com\/?p=851#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"http:\/\/www.ponybai.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668\"}]},{\"@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-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668 - \u767d\u767d\u968f\u7b14","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=851","og_locale":"zh_CN","og_type":"article","og_title":"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668 - \u767d\u767d\u968f\u7b14","og_description":"Visualforce\u7535\u5b50\u90ae\u4ef6\u6a21\u677f\u53ef\u4ee5\u5229\u7528\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u5448\u73b0\u9ad8\u5ea6\u81ea\u5b9a\u4e49\u7684\u5185\u5bb9\u4e3a\u6b64\uff0c\u8bf7\u5728\u4f7f\u7528\u8be5\u81ea\u5b9a\u4e49\u63a7\u5236\u5668\u7684Vis &hellip; \u7ee7\u7eed\u9605\u8bfbVisualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668","og_url":"http:\/\/www.ponybai.com\/?p=851","og_site_name":"\u767d\u767d\u968f\u7b14","article_published_time":"2018-01-29T05:13:48+00:00","og_image":[{"width":248,"height":248,"url":"http:\/\/www.ponybai.com\/wp-content\/uploads\/2023\/11\/cropped-weixin2.jpg","type":"image\/jpeg"}],"author":"ponybai","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"ponybai","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.ponybai.com\/?p=851#article","isPartOf":{"@id":"http:\/\/www.ponybai.com\/?p=851"},"author":{"name":"ponybai","@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"headline":"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668","datePublished":"2018-01-29T05:13:48+00:00","dateModified":"2018-01-29T05:13:48+00:00","mainEntityOfPage":{"@id":"http:\/\/www.ponybai.com\/?p=851"},"wordCount":149,"publisher":{"@id":"http:\/\/www.ponybai.com\/#\/schema\/person\/935c7592c850c65e1e5eba4530dbf883"},"articleSection":["Visualforce-\u90ae\u4ef6\u6a21\u677f"],"inLanguage":"zh-Hans"},{"@type":"WebPage","@id":"http:\/\/www.ponybai.com\/?p=851","url":"http:\/\/www.ponybai.com\/?p=851","name":"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668 - \u767d\u767d\u968f\u7b14","isPartOf":{"@id":"http:\/\/www.ponybai.com\/#website"},"datePublished":"2018-01-29T05:13:48+00:00","dateModified":"2018-01-29T05:13:48+00:00","breadcrumb":{"@id":"http:\/\/www.ponybai.com\/?p=851#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.ponybai.com\/?p=851"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.ponybai.com\/?p=851#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"http:\/\/www.ponybai.com\/"},{"@type":"ListItem","position":2,"name":"Visualforce-\u90ae\u4ef6\u6a21\u677f\uff084\uff09\u63a7\u5236\u5668"}]},{"@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\/851","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=851"}],"version-history":[{"count":0,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=\/wp\/v2\/posts\/851\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=851"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ponybai.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}