<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>WebDH blog - SalesForce</title>
			<link>http://blog.webdh.com/index.cfm</link>
			<description>This is Troy&apos;s blog for WebDH.com LLC.</description>
			<language>en-us</language>
			<pubDate>Mon, 06 Sep 2010 12:50:57 -0700</pubDate>
			<lastBuildDate>Tue, 03 Mar 2009 16:02:00 -0700</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>webdh.com@gmail.com</managingEditor>
			<webMaster>webdh.com@gmail.com</webMaster>
			
			<item>
				<title>ColdFusion page added to SalesForce wiki</title>
				<link>http://blog.webdh.com/index.cfm/2009/3/3/ColdFusion-page-added-to-SalesForce-wiki</link>
				<description>
				
				Today I added a section for &lt;b&gt;Adobe ColdFusion&lt;/b&gt; to the SalesForce Developer Wiki under the &lt;a href=&quot;http://wiki.apexdevnet.com/index.php/Web_Services_API&quot; target=&quot;_blank&quot;&gt;Web Services API&lt;/a&gt; section. 

I then added the first code sample article, showing how to do a &lt;a href=&quot;http://wiki.apexdevnet.com/index.php/Basic_Web2Lead_Implementation&quot; target=&quot;_blank&quot;&gt;Basic Web2Lead Implementation&lt;/a&gt;. I looked at a similar PHP sample done by Wayne Abbott as the basis for my article.

Hopefully this will spur others in the CF Community to start adding more content to this wiki and spread the knowledge of CF as a viable web development platform. 
				</description>
				
				<category>SalesForce</category>				
				
				<pubDate>Tue, 03 Mar 2009 16:02:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2009/3/3/ColdFusion-page-added-to-SalesForce-wiki</guid>
				
			</item>
			
			<item>
				<title>Tips for testing web-to-lead on SalesForce sandbox server</title>
				<link>http://blog.webdh.com/index.cfm/2009/3/3/Tips-for-testing-webtolead-on-SalesForce-sandbox-server</link>
				<description>
				
				The SalesForce Web-to-Lead URL is well known to be: 
https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8

If you have access to a Sandbox server to do your development, you may want to test Web-to-Lead against it. You first should go into the setup area to find your OID (Organization ID) which will differ from your production OID. Find this from SalesForce&apos;s top &quot;Setup&quot; link. Then drill down into the left navigation menu:&lt;br&gt;
App Setup / Customize / Leads / Web-to-Lead&lt;br&gt;
Make sure the checkbox for Web-to-Lead Enabled is checked. Then click the &quot;Create Web-to-Lead Form&quot; button. On the next page, keep all selected fields as defaults and click the &quot;Generate&quot; button. Look in the generated HTML output for your unique OID which is given in the first hidden form field. You should see lines of code like this:

&lt;code&gt;
&lt;!--  ----------------------------------------------------------------------  --&gt;
&lt;!--  NOTE: Please add the following &lt;META&gt; element to your page &lt;HEAD&gt;.      --&gt;
&lt;!--  If necessary, please modify the charset parameter to specify the        --&gt;
&lt;!--  character set of your HTML page.                                        --&gt;
&lt;!--  ----------------------------------------------------------------------  --&gt;

&lt;META HTTP-EQUIV=&quot;Content-type&quot; CONTENT=&quot;text/html; charset=UTF-8&quot;&gt;

&lt;!--  ----------------------------------------------------------------------  --&gt;
&lt;!--  NOTE: Please add the following &lt;FORM&gt; element to your page.             --&gt;
&lt;!--  ----------------------------------------------------------------------  --&gt;

&lt;form action=&quot;https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8&quot; method=&quot;POST&quot;&gt;

&lt;input type=hidden name=&quot;oid&quot; value=&quot;youroidhere&quot;&gt;
&lt;/code&gt;

Remember, you are developing for tests against the Sandbox server, so you will need to modify the Form action to match the URL of your Sandbox homepage. Look at your Sandbox url and replace &quot;www&quot; with the proper subdomain, such as &quot;cs2&quot; in this example. &lt;br&gt;
Example Sandbox homepage: https://cs2.salesforce.com/home/home.jsp &lt;br&gt;
New Web-to-Lead Form action: https://cs2.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8 
				</description>
				
				<category>SalesForce</category>				
				
				<pubDate>Tue, 03 Mar 2009 14:14:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2009/3/3/Tips-for-testing-webtolead-on-SalesForce-sandbox-server</guid>
				
			</item>
			
			<item>
				<title>Using ColdFusion to create a Lead in SalesForce using SOAP</title>
				<link>http://blog.webdh.com/index.cfm/2007/10/11/Using-CF-to-create-a-Lead-in-SalesForce-using-SOAP</link>
				<description>
				
				At my day job, &lt;a href=&quot;http://www.securecomputing.com/&quot; target=&quot;_blank&quot;&gt;Secure Computing&lt;/a&gt;, I needed to figure out how to create a new Lead in &lt;a href=&quot;https://www.salesforce.com/&quot; target=&quot;_blank&quot;&gt;SalesForce&lt;/a&gt; from a partner deal registration web application.  I already had experience using Web-to-lead (WTL), but this would not work for the type of Lead I was trying to create.  In this case, the Lead had fields for a Contact and Account (both lookup fields), which WTL doesn&apos;t support.

I did some google searching for ColdFusion web services and SalesForce and found myself at the Adobe forums.  After reading all the posts and grabbing some sample code, I started to figure it out.  After a few days of coding and testing using SOAP web services, I had my solution.  I posted my findings back to the Adobe forum to give back to the community, and my submission is &lt;a href=&quot;http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=7&amp;amp;threadid=781179&amp;amp;filtmsgid=4732507#4732507&quot; target=&quot;_blank&quot;&gt;found here on page 3&lt;/a&gt; (posted by &quot;tccfug&quot;).  The only drawback is I wasn&apos;t able to associate the Lead to a Campaign.  However, it wasn&apos;t a show stopper and my solution is now in production.

Here&apos;s the code, hope it will help somebody else down the road...
Make sure you change the first lines of code with your respective username and password to login to SalesForce. This is required to first begin a new session, then create the lead with the sessionid.

&lt;code&gt;
&lt;cfsetting showdebugoutput=&quot;No&quot;&gt;
&lt;cfset UserName = &quot;myemail@mydomain.com&quot;&gt;
&lt;cfset Pwd = &quot;mypassword&quot;&gt;
&lt;cfset loginurl = &quot;https://www.salesforce.com/services/Soap/u/9.0&quot;&gt;

&lt;!---
LOGIN TO SALESFORCE TO START A NEW SESSION
---&gt;
&lt;cfoutput&gt;
&lt;cfsavecontent variable = &quot;LoginSOAP&quot;&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;
xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;
&lt;SOAP-ENV:Header&gt;
&lt;m:LoginScopeHeader xmlns:m=&quot;urn:partner.soap.sforce.com&quot;&gt; &lt;m:organizationId&gt;&lt;/m:organizationId&gt;
&lt;/m:LoginScopeHeader&gt;
&lt;m:CallOptions xmlns:m=&quot;urn:partner.soap.sforce.com&quot;&gt;
&lt;m:client&gt;&lt;/m:client&gt;
&lt;/m:CallOptions&gt;
&lt;/SOAP-ENV:Header&gt;
&lt;SOAP-ENV:Body&gt;&lt;!---Body of Soap---&gt;
&lt;m:login xmlns:m=&quot;urn:partner.soap.sforce.com&quot;&gt;
&lt;m:username&gt;#UserName#&lt;/m:username&gt;&lt;!---User Name for login---&gt; 
&lt;m:password&gt;#Pwd#&lt;/m:password&gt;&lt;!---Password for Login---&gt;
&lt;/m:login&gt;
&lt;/SOAP-ENV:Body&gt;&lt;!---end of the body---&gt;
&lt;/SOAP-ENV:Envelope&gt;&lt;/cfsavecontent&gt;&lt;!---End of the Login SOAP---&gt;
&lt;/cfoutput&gt;
&lt;cfhttp url=&quot;#loginurl#&quot; method=&quot;post&quot;&gt;&lt;!---Variables to be posted at this URL ---&gt;
&lt;cfheader name=&quot;Content-Type&quot; value=&quot;text/xml; charset=utf-8&quot; /&gt;
&lt;cfhttpparam type=&quot;xml&quot; value=&quot;#LoginSOAP#&quot; /&gt;
&lt;cfhttpparam type=&quot;header&quot; name=&quot;SOAPAction&quot; value=&quot;login&quot; /&gt;&lt;!---method of the web service---&gt;
&lt;/cfhttp&gt;
&lt;!--- the following parses out the ServerURL and the SessionID which will be used in the 2nd SOAP request to generate a Lead ---&gt;
&lt;cfset serurl_start = Find(&quot;&lt;serverUrl&gt;&quot;,cfhttp.FileContent)&gt;
&lt;cfset serurl_end = Find(&quot;&lt;/serverUrl&gt;&quot;,cfhttp.FileContent)&gt;
&lt;cfset serurl_final = Trim(Mid(cfhttp.FileContent,serurl_start+11,serurl_end-(serurl_start+11)))&gt;
&lt;cfset sesid_start = Find(&quot;&lt;sessionId&gt;&quot;,cfhttp.FileContent)&gt;
&lt;cfset sesid_end = Find(&quot;&lt;/sessionId&gt;&quot;,cfhttp.FileContent)&gt;
&lt;cfset sesid_final = Trim(Mid(cfhttp.FileContent,sesid_start+11,sesid_end-(sesid_start+11)))&gt;



&lt;!---
LEAD SUBMISSION WHICH NEEDS TO USE SESSION FROM LOGIN ABOVE 
---&gt;
&lt;cfoutput&gt;
&lt;cfsavecontent variable=&quot;LeadSoap&quot;&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; 
&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; 
xmlns:SOAP-ENC=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; 
xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;&gt;  
&lt;soapenv:Header&gt;
  &lt;ns1:SessionHeader soapenv:mustUnderstand=&quot;0&quot; xmlns:ns1=&quot;urn:enterprise.soap.sforce.com&quot;&gt;    
   &lt;ns2:sessionId xmlns:ns2=&quot;urn:enterprise.soap.sforce.com&quot;&gt;#sesid_final#&lt;/ns2:sessionId&gt;   
  &lt;/ns1:SessionHeader&gt;  
 &lt;/soapenv:Header&gt;  
 &lt;soapenv:Body&gt;   
 &lt;create xmlns=&quot;urn:enterprise.soap.sforce.com&quot;&gt;    
  &lt;sObjects xsi:type=&quot;ns3:Lead&quot; xmlns:ns3=&quot;urn:sobject.enterprise.soap.sforce.com&quot;&gt;     
   &lt;ns3:RecordTypeId&gt;01250000000DKxf&lt;/ns3:RecordTypeId&gt;  &lt;!--- hardcoded for Prospects ---&gt;
   &lt;ns3:FirstName&gt;Rich&lt;/ns3:FirstName&gt;     
   &lt;ns3:LastName&gt;Dude&lt;/ns3:LastName&gt;
   &lt;ns3:Title&gt;CEO&lt;/ns3:Title&gt;
   &lt;ns3:Email&gt;rich_dude@prospect.com&lt;/ns3:Email&gt;
   &lt;ns3:Company&gt;TEST&lt;/ns3:Company&gt;
   &lt;ns3:Street&gt;123 Money Lane&lt;/ns3:Street&gt;
   &lt;ns3:City&gt;Las Vegas&lt;/ns3:City&gt;
   &lt;ns3:State&gt;NV&lt;/ns3:State&gt;
   &lt;ns3:Country&gt;US&lt;/ns3:Country&gt;
   &lt;ns3:PostalCode&gt;89109&lt;/ns3:PostalCode&gt;
   &lt;ns3:Phone&gt;888-PHONE&lt;/ns3:Phone&gt;
   &lt;ns3:Fax&gt;777-FAX&lt;/ns3:Fax&gt;
   &lt;ns3:LeadSource&gt;Other&lt;/ns3:LeadSource&gt;
   &lt;ns3:OwnerId&gt;00550000000wtO9&lt;/ns3:OwnerId&gt;&lt;!--- CFID of contact ---&gt;
   &lt;!--- And any other fields
   See http://www.sforce.com/resources/api.jsp for SOAP Message examples
   See http://www.sforce.com for documentation on the fields you can send. ---&gt;
  &lt;/sObjects&gt;    
&lt;/create&gt;  
&lt;/soapenv:Body&gt; 
&lt;/soapenv:Envelope&gt;&lt;/cfsavecontent&gt;
&lt;/cfoutput&gt;

&lt;cfhttp url=&quot;#serurl_final#&quot; method=&quot;POST&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;Content-Type&quot; value=&quot;text/xml; charset=utf-8&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;Accept&quot; value=&quot;application/soap+xml, application/dime, multipart/related, text/*&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;User-Agent&quot; value=&quot;Axis/1.1&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;Host&quot; value=&quot;na1.salesforce.com&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;Cache-Control&quot; value=&quot;no-cache&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;Pragma&quot; value=&quot;no-cache&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;Version&quot; value=&quot;HTTP/1.0&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;SOAPAction&quot; value=&quot;update&quot;&gt;
 &lt;cfhttpparam type=&quot;HEADER&quot; name=&quot;Content-Length&quot; value=&quot;#len(trim(LeadSoap))#&quot;&gt;
 &lt;cfhttpparam type=&quot;BODY&quot; value=&quot;#trim(LeadSoap)#&quot;&gt;
&lt;/cfhttp&gt;

&lt;cfset faultcode_start = Find(&quot;&lt;faultcode&gt;&quot;,cfhttp.FileContent)&gt;
&lt;cfset success_start = Find(&quot;&lt;success&gt;&quot;,cfhttp.FileContent)&gt;
&lt;cfcontent type=&quot;text/html&quot; reset=&quot;Yes&quot;&gt;
&lt;cfif success_start&gt;
	&lt;cfset leadid_start = Find(&quot;&lt;id&gt;&quot;,cfhttp.FileContent)&gt;
	&lt;cfset leadid_end = Find(&quot;&lt;/id&gt;&quot;,cfhttp.FileContent)&gt;
	&lt;cfset leadid_final = Trim(Mid(cfhttp.FileContent,leadid_start+4,leadid_end-(leadid_start+4)))&gt;
	&lt;cfoutput&gt;
	&lt;b&gt;Lead ID: &lt;a href=&quot;https://na3.salesforce.com/#Left(leadid_final,15)#&quot; target=&quot;_blank&quot;&gt;#Left(leadid_final,15)#&lt;/a&gt;&lt;/b&gt;
	&lt;/cfoutput&gt;

&lt;cfelseif faultcode_start&gt;
	&lt;cfset faultcode_end = Find(&quot;&lt;/faultcode&gt;&quot;,cfhttp.FileContent)&gt;
	&lt;cfset faultcode_final = Trim(Mid(cfhttp.FileContent,faultcode_start+11,faultcode_end-(faultcode_start+11)))&gt;
	&lt;cfset faultstring_start = Find(&quot;&lt;faultstring&gt;&quot;,cfhttp.FileContent)&gt;
	&lt;cfset faultstring_end = Find(&quot;&lt;/faultstring&gt;&quot;,cfhttp.FileContent)&gt;
	&lt;cfset faultstring_final = Trim(Mid(cfhttp.FileContent,faultstring_start+13,faultstring_end-(faultstring_start+13)))&gt;
	&lt;cfoutput&gt;
	&lt;b&gt;Fault Code: #faultcode_final#&lt;/b&gt;&lt;br&gt;
	&lt;b&gt;Fault String: #faultstring_final#&lt;/b&gt;
	&lt;/cfoutput&gt;

&lt;cfelse&gt;
	&lt;b&gt;Unknown response&lt;/b&gt;&lt;br&gt;
	&lt;cfoutput&gt;#cfhttp.FileContent#&lt;/cfoutput&gt; 
&lt;/cfif&gt;
&lt;/code&gt; 
				</description>
				
				<category>SalesForce</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Thu, 11 Oct 2007 09:56:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2007/10/11/Using-CF-to-create-a-Lead-in-SalesForce-using-SOAP</guid>
				
			</item>
			
			<item>
				<title>Naming a ColdFusion variable beginning with a number</title>
				<link>http://blog.webdh.com/index.cfm/2007/1/12/Naming-a-ColdFusion-variable-beginning-with-a-number</link>
				<description>
				
				The naming rules for creating ColdFusion variables are found &lt;a href=&quot;http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/variabl3.htm&quot;&gt;here in the LiveDocs&lt;/a&gt;. The first bullet point is
&lt;ul&gt;
&lt;li&gt;A variable name must begin with a letter, underscore, or Unicode currency symbol.
&lt;/ul&gt;
However, I am doing some integration with SalesForce.com, and they have custom variables that are named like &quot;00N30000000dqFd&quot;. Now, if I want to name a form variable with that name, and do some validation before posting the form, I was running into problems. Here is some sample code and comments that outline my struggles. If you comment out the 3 spots (lines 3, 8, and 13-15) that throw errors, the code will run and you will get the 3 cfdumps.

&lt;code&gt;
&lt;cfset field = &quot;00N30000000dqFd&quot;&gt; &lt;!--- here is a variable that we assign a value starting with a number ---&gt;

&lt;!--- &lt;cfset 00N30000000dqFd = &quot;test&quot;&gt; ---&gt; &lt;!--- variable starting with number throws error: &quot;00N30000000dqFd,&quot; on line 3, column 8, is not a valid identifer name. ---&gt;
&lt;cfparam name=&quot;form.#field#&quot; default=&quot;&quot;&gt; &lt;!--- paraming &quot;00N30000000dqFd&quot; in the form scope is ok ---&gt;
&lt;cfdump var=&quot;#form#&quot; label=&quot;after param&quot;&gt;


&lt;!--- &lt;cfset &quot;form.#field#&quot; = &quot;new value&quot;&gt; ---&gt; &lt;!--- doing this cfset method throws an error: The string &quot;form.00N30000000dqFd&quot; is not a valid ColdFusion variable name. ---&gt;
&lt;cfset form[&quot;#field#&quot;] = &quot;1st value&quot;&gt; &lt;!--- doing the structure method sets the variable ok ---&gt;
&lt;cfdump var=&quot;#form#&quot; label=&quot;after assigning&quot;&gt;


&lt;!--- &lt;cfif IsDefined(&quot;form.#field#&quot;)&gt;  &lt;!--- doing this IsDefined() method of checking if the variable exists in the Form scope throws an error: Parameter 1 of function IsDefined, which is now &quot;form.00N30000000dqFd&quot;, must be a syntactically valid variable name.---&gt;
	&lt;cfset &quot;form.#field#&quot; = &quot;2nd value&quot;&gt;
&lt;/cfif&gt;---&gt;
&lt;cfif StructKeyExists(form,field)&gt; &lt;!--- doing this structure key check method is ok ---&gt;
	&lt;cfset form[&quot;#field#&quot;] = &quot;2nd value&quot;&gt;
&lt;/cfif&gt;
&lt;cfdump var=&quot;#form#&quot; label=&quot;end of demo&quot;&gt;
&lt;/code&gt;


Here is a &lt;a href=&quot;http://blog.webdh.com/demos/20070112.cfm&quot; target=&quot;_blank&quot;&gt;demo&lt;/a&gt; of this in action. 
				</description>
				
				<category>SalesForce</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 12 Jan 2007 15:28:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2007/1/12/Naming-a-ColdFusion-variable-beginning-with-a-number</guid>
				
			</item>
			</channel></rss>