+ Start a Discussion

Problems in accessing look up field page data in a web page

I am trying to access a look up field data from a web page but it is working when i select any listed data in a lookup data listing
here, I found some stuff from the community board
In which, it is stated that you can not access any lookup field from web to lead form
I have put all the html code in s-Control then that lookup field is working fine but when I copied the same html in external server
page and called in a salesforce webtab then it is not workable for me.
So, Kindly suggest me any alternatives / solution on this

Thanks & Regards
I answered this on the General Development board.  Please don't cross-post these questions.

The web-to-whatever forms that SFDC creates for you are just HTML snippets, meant to sit on any server.  Without any sort of backend technology, they'll never be able to hit live SFDC data.  Let me see if I understand your problem:

- You're trying to create a web to lead page, using the web to lead form generator within SFDC.  You want to make a Select box that contains picklist values from a Salesforce picklist.

- You've copied that HTML to an s-Control, and used the javascript ajax toolkit to connect to SFDC data, and were able to populate the select boxes' options

- You then took that HTML and copied it to an external page, called that in as a web tab, and were unable to access the SFDC data at that point

I'm not sure if I understand why you're pulling a web to lead form back into the Salesforce UI, since they're meant for external sites, however I will point out a few things that you need to consider with your approach.

The AJAX toolkit is designed to run from HTML pages (s-Controls) sitting on Salesforce servers.  The toolkit uses javascript to make web service calls against the Salesforce API, which is located in the same domain as the s-Control.  If you move this code to a different domain, you will run into a host of issues with browsers trying to run it, cross site scripting (XSS) limitations.  Typically, a browser hitting a page in one domain will reject any javascript on that page which tries to connect to another domain.  In addition, like any other service which would hit the Salesforce API, you need to supply login credentials.  When you use the ajax toolkit in an sControl, I believe the login is done automatically as the user who is viewing the page; however, moving this page to another domain means that you'd need to hard-code login information, and everyone who views source on your page may be able to see enough information to steal an API user login to your organization.

This is why web-to-lead was created in the first place -- it does not require a login to submit information to SFDC; however, you would need a login to retrieve any information back from SFDC, such as picklist values.

Your best bet is to scrap the ajax toolkit, and use a server-side technology, such as JSP or ASP.NET.