{"id":359,"date":"2010-06-27T21:55:59","date_gmt":"2010-06-27T16:25:59","guid":{"rendered":"http:\/\/JitendraZaa.com\/blog\/?p=359"},"modified":"2010-06-27T21:55:59","modified_gmt":"2010-06-27T16:25:59","slug":"how-to-create-s-control-in-salesforce","status":"publish","type":"post","link":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/how-to-create-s-control-in-salesforce\/","title":{"rendered":"How to create S-Control in Salesforce"},"content":{"rendered":"<p>To demonstrate this, lets consider an example of <strong>Google Map.<\/strong><\/p>\n<p>Lets create a S-Control for the Google Map.<\/p>\n<p>Now let&#8217;s first create a new S-Control:<\/p>\n<ol>\n<li>Click on &#8220;Setup&#8221; which is located on the top right corner of the force.com page.<\/li>\n<li>Expand &#8220;Develop&#8221; item and click on &#8220;S-Controls&#8221;<\/li>\n<li>Hit &#8220;New Custom\u00a0S-Control&#8221;<\/li>\n<li>Provide a Label &#8220;<span>Google Map<\/span>&#8221; and a description is you wished to<\/li>\n<li>The Type should be HTML since we want to create a HTML, Google API mash up<\/li>\n<li>Now it is time to enter the code for the S-Control<\/li>\n<\/ol>\n<div><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/06\/S-Control-Option.png?ssl=1\" alt=\"S-Control in Salesforce.com\" align=\"none\" \/><\/div>\n<div>\n<div>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n&lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot; xmlns:v=&quot;urn:schemas-microsoft-com:vml&quot;&gt;\n&lt;head&gt;\n&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text\/html; charset=utf-8&quot; \/&gt;\n&lt;title&gt;Google Maps JavaScript API Example: Advanced Directions&lt;\/title&gt;\n&lt;link href=&quot;\/dCSS\/Theme2\/default\/common.css&quot; type=&quot;text\/css&quot; media=&quot;handheld,print,projection,screen,tty,tv&quot;\nrel=&quot;stylesheet&quot;&gt;\n&lt;link href=&quot;\/dCSS\/Theme2\/default\/custom.css&quot; type=&quot;text\/css&quot; media=&quot;handheld,print,projection,screen,tty,tv&quot;\nrel=&quot;stylesheet&quot;&gt;\n\n&lt;script src=&quot; http:\/\/maps.google.com\/?file=api&amp;amp;v=2.x&amp;amp;key={YOUR KEY}&quot;\ntype=&quot;text\/javascript&quot;&gt;&lt;\/script&gt;\n\n&lt;script src=&quot;\/js\/functions.js&quot; type=&quot;text\/javascript&quot;&gt;&lt;\/script&gt;\n\n&lt;script type=&quot;text\/javascript&quot; src=&quot;\/soap\/ajax\/13.0\/connection.js&quot;&gt;&lt;\/script&gt;\n\n&lt;style type=&quot;text\/css&quot;&gt;\nbody {\nfont-family: Verdana, Arial, sans serif;\nfont-size: 11px;\nmargin: 2px;\n}\ntable.directions th {\nbackground-color:#EEEEEE;\n}\n\nimg {\ncolor: #000000;\n}\n&lt;\/style&gt;\n\n&lt;script type=&quot;text\/javascript&quot;&gt;\n\nvar map;\nvar gdir;\nvar geocoder = null;\nvar addressMarker;\nvar dirFrom = '{!$Request.from}';\nvar dirTo = '{!$Request.to}';\nvar mapLocale = &quot;&quot;\nvar SControlID = '{!$Request.lid}';\nvar SFrameIC = '{!$Request.ic}';\n\n\nfunction\u00a0initValues()\n{\nmapLocale = &quot;en_US&quot;;\n\nsetInputFields(dirFrom,dirTo);\n}\n\nfunction\u00a0setInputFields(from, to)\n{\nwindow.document.getElementById(&quot;fromAddress&quot;).value = from;\nwindow.document.getElementById(&quot;toAddress&quot;).value = to;\n}\n\n\nfunction\u00a0initialize()\n{\ninitValues();\n\nif (GBrowserIsCompatible()) {\nmap = new GMap2(document.getElementById(&quot;map_canvas&quot;));\nmap.addControl(new GSmallMapControl());\nmap.addControl(new GMapTypeControl());\ngdir = new GDirections(map, document.getElementById(&quot;directions&quot;));\nGEvent.addListener(gdir, &quot;load&quot;, onGDirectionsLoad);\nGEvent.addListener(gdir, &quot;error&quot;, handleErrors);\n\nsetDirections(dirFrom, dirTo, mapLocale);\n}\n}\n\nfunction\u00a0setDirections(fromAddress, toAddress, locale) {\nif ((fromAddress) &amp;&amp; (toAddress))\ngdir.load(&quot;from: &quot; + fromAddress + &quot; to: &quot; + toAddress,\n{ &quot;locale&quot;: locale });\n}\n\nfunction\u00a0handleErrors()\n{\nif (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)\nalert(&quot;No corresponding geographic location could be found for one of the specified addresses. This may be due to the fact that the address is relatively new, or it may be incorrect.nError code: &quot; + gdir.getStatus().code);\nelse if (gdir.getStatus().code == G_GEO_SERVER_ERROR)\nalert(&quot;A geocoding or directions request could not be successfully processed, yet the exact reason for the failure is not known.n Error code: &quot; + gdir.getStatus().code);\n\nelse if (gdir.getStatus().code == G_GEO_MISSING_QUERY)\nalert(&quot;The HTTP q parameter was either missing or had no value. For geocoder requests, this means that an empty address was specified as input. For directions requests, this means that no query was specified in the input.n Error code: &quot; + gdir.getStatus().code);\n\n\/\/ else if (gdir.getStatus().code == G_UNAVAILABLE_ADDRESS) &lt;--- Doc bug... this is either not defined, or Doc is wrong\n\/\/ alert(&quot;The geocode for the given address or the route for the given directions query cannot be returned due to legal or contractual reasons.n Error code: &quot; + gdir.getStatus().code);\n\nelse if (gdir.getStatus().code == G_GEO_BAD_KEY)\nalert(&quot;The given key is either invalid or does not match the domain for which it was given. n Error code: &quot; + gdir.getStatus().code);\n\nelse if (gdir.getStatus().code == G_GEO_BAD_REQUEST)\nalert(&quot;A directions request could not be successfully parsed.n Error code: &quot; + gdir.getStatus().code);\n\nelse alert(&quot;An unknown error occurred.&quot;);\n\n}\n\nfunction\u00a0onGDirectionsLoad(){\n\/\/ Use this\u00a0function\u00a0to access information about the latest load()\n\/\/ results.\n\n\/\/ e.g.\n\/\/ document.getElementById(&quot;getStatus&quot;).innerHTML = gdir.getStatus().code;\n\/\/ and\u00a0yada yada yada...\n}\n&lt;\/script&gt;\n\n&lt;\/head&gt;\n&lt;body onload=&quot;initialize()&quot; onunload=&quot;GUnload()&quot;&gt;\n&lt;div style=&quot;background-color: #CCCCCC&quot;&gt;\n&lt;form action=&quot;#&quot; onsubmit=&quot;setDirections(this.from.value, this.to.value, this.locale.value); return false&quot;&gt;\n&lt;table&gt;\n&lt;tr&gt;\n&lt;th align=&quot;right&quot;&gt;\nFrom:&amp;nbsp;&lt;\/th&gt;\n&lt;td&gt;\n&lt;input type=&quot;text&quot; size=&quot;25&quot; id=&quot;fromAddress&quot; name=&quot;from&quot; value=&quot;&quot; \/&gt;&lt;\/td&gt;\n&lt;th align=&quot;right&quot;&gt;\n&amp;nbsp;&amp;nbsp;To:&amp;nbsp;&lt;\/th&gt;\n&lt;td align=&quot;right&quot;&gt;\n&lt;input type=&quot;text&quot; size=&quot;25&quot; id=&quot;toAddress&quot; name=&quot;to&quot; value=&quot;&quot; \/&gt;&lt;\/td&gt;\n&lt;th align=&quot;right&quot;&gt;\nLanguage:&amp;nbsp;&lt;\/th&gt;\n&lt;th align=&quot;right&quot;&gt;\n&lt;select id=&quot;locale&quot; name=&quot;locale&quot;&gt;\n&lt;option value=&quot;en&quot; selected=&quot;selected&quot;&gt;English&lt;\/option&gt;\n&lt;option value=&quot;fr&quot;&gt;French&lt;\/option&gt;\n&lt;option value=&quot;de&quot;&gt;German&lt;\/option&gt;\n&lt;option value=&quot;ja&quot;&gt;Japanese&lt;\/option&gt;\n&lt;option value=&quot;es&quot;&gt;Spanish&lt;\/option&gt;\n&lt;\/select&gt;\n&lt;\/th&gt;\n&lt;td&gt;\n&lt;input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;Get Directions!&quot; \/&gt;&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;\/table&gt;\n&lt;\/form&gt;\n&lt;\/div&gt;\n&lt;div style=&quot;border-width: 1px; border-color: #000000; border-style: solid;&quot;&gt;\n&lt;div style=&quot;overflow: auto; width: 99.5%; height: 380px&quot;&gt;\n&lt;table class=&quot;directions&quot; style=&quot;width: 100%; height: 100%&quot;&gt;\n&lt;tr&gt;\n&lt;td valign=&quot;top&quot; style=&quot;width: 275px;&quot;&gt;\n&lt;div id=&quot;directions&quot; style=&quot;width: 275px; background-color: #ffffff;&quot;&gt;\n&lt;\/div&gt;\n&lt;\/td&gt;\n&lt;td valign=&quot;top&quot;&gt;\n&lt;div id=&quot;map_canvas&quot; style=&quot;width: 100%; height: 375px; background-color: #ffffff;&quot;&gt;\n&lt;\/div&gt;\n&lt;\/td&gt;\n&lt;\/tr&gt;\n&lt;\/table&gt;\n&lt;\/div&gt;\n&lt;\/div&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/pre>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Explains that how to create a S-Control in Salesforce.com<\/p>\n","protected":false},"author":1,"featured_media":365,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"jz_research_post":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[9],"tags":[331],"class_list":["post-359","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-salesforce","tag-salesforce"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":370,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/how-to-host-s-control-in-visualforce-page\/","url_meta":{"origin":359,"position":0},"title":"How to Host S-Control in Visualforce Page","author":"Jitendra","date":"June 27, 2010","format":false,"excerpt":"Explains that How to Host S-Control in Visualforce Page","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Visual force page in Salesforce.com","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2010\/06\/VF-Page.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":28,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-interview-questions\/","url_meta":{"origin":359,"position":1},"title":"Salesforce Interview Questions &#8211; Part 1","author":"Jitendra","date":"May 6, 2010","format":false,"excerpt":"Set of most often asked questions on the salesforce.com developement","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3951,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/creating-salesforce-query-builder-in-node-js-and-angularjs-using-salesforce-rest-api-and-oauth2\/","url_meta":{"origin":359,"position":2},"title":"Creating Salesforce Query Builder in Node.js and AngularJs using Salesforce REST API and OAuth2 with Heroku Button","author":"Jitendra","date":"August 18, 2014","format":false,"excerpt":"In this post, we will be creating a\u00a0Salesforce Query (SOQL) Builder.\u00a0It uses Google's Angularjs MVC Javascript library and REST API provided by Salesforce. For Authentication, it uses OAuth2. Node.js is used as a primary language and hosted on Heroku. If you want to directly deploy to your Heroku Account, You\u2026","rel":"","context":"In &quot;HTML&quot;","block_context":{"text":"HTML","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/webtech\/web\/"},"img":{"alt_text":"SOQL Builder Using Node.js AngularJs Salesforce REST API on Heroku","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/08\/SOQL-Builder-Using-Node.js-AngularJs-Salesforce-REST-API-on-Heroku-1024x504.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/08\/SOQL-Builder-Using-Node.js-AngularJs-Salesforce-REST-API-on-Heroku-1024x504.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2014\/08\/SOQL-Builder-Using-Node.js-AngularJs-Salesforce-REST-API-on-Heroku-1024x504.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5070,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/dependent-picklist-in-salesforce-flow-using-custom-metadata-type-video\/","url_meta":{"origin":359,"position":3},"title":"Dependent picklist in Salesforce flow using Custom Metadata type &#8211; Video","author":"Jitendra","date":"December 7, 2015","format":false,"excerpt":"Salesforce flow is great alternative for Visualforce pages used by admin. I have written, multiple blog post on Salesforce flow already and in this post we will discuss how we can create dependent picklist in Flow. If you are already using flow, might know that creating dependent picklist is not\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Salesforce flow - Dependent picklist output","src":"https:\/\/i0.wp.com\/www.jitendrazaa.com\/blog\/wp-content\/uploads\/2015\/12\/Salesforce-flow-Dependent-picklist-output.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3773,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/salesforce-faq-part-19\/","url_meta":{"origin":359,"position":4},"title":"Salesforce interview questions &#8211; Part 19","author":"Jitendra","date":"December 16, 2014","format":false,"excerpt":"Salesforce interview questions for developers and admins around Apex, Visualforce, getting Salesforce object name on basis of Id, Apex API limits","rel":"","context":"In &quot;Apex&quot;","block_context":{"text":"Apex","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/apex\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3106,"url":"https:\/\/www.jitendrazaa.com\/blog\/salesforce\/change-year-range-in-datepicker-salesforce\/","url_meta":{"origin":359,"position":5},"title":"Change year range in Datepicker &#8211; Salesforce","author":"Jitendra","date":"September 20, 2012","format":false,"excerpt":"In Datepicker control of salesforce, most of the developers must have faced issue on year range for Datepicker control. We cannot configure the year range in standard date picker control. However, for a long time i am using a JQuery code to change the range of years in Datepicker and\u2026","rel":"","context":"In &quot;Salesforce&quot;","block_context":{"text":"Salesforce","link":"https:\/\/www.jitendrazaa.com\/blog\/category\/salesforce\/"},"img":{"alt_text":"Year Range in Salesforce Date Picker","src":"https:\/\/i0.wp.com\/jitendrazaa.com\/blog\/wp-content\/uploads\/2012\/09\/Year-Range-in-Salesforce-Date-Picker.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":0,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.jitendrazaa.com\/blog\/wp-json\/wp\/v2\/tags?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}