+ Start a Discussion
ShaunCShaunC 

Look up custom field id in form at runtime

Hi All,

 

Firstly, I know this question has been asked previously here. But the suggested solution isn't working for me.

http://community.salesforce.com/t5/AJAX-Toolkit-S-Controls/Look-up-custom-field-id-in-form-at-runtime/m-p/71306

 

I am trying to create a sample Web-2-Lead form and include it as a VF page in a Package. The problem is that the ID's used for the custom Lead fields are different between organisations. And the custom fields in the W2L field reference those ID's directly. eg:

 

TestCustomField1:<input  id="00NA00000046zKY" maxlength="20" name="00NA00000046zKY" size="20" type="text" /><br />

 

It was suggested in the thread above that these ID's would automatically be updated to match the new Field ID's when the package was installed into a new Org. However this didn't work for me.

 

So again I ask the question, is it possible to retrieve the ID of a field programatically, in Apex or VF? I have looked at the SObjectField and DescribeFieldResult classes, but neither exposes the ID.

 

Thanks in advance for any help.