function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
rushrush 

pass default value to a field on public VF Page

I have what I thought woudl be a very simple scenario to setup, but am having issues getting anything to come through on it, though no errors actually appear.

 

I have this on my visual force page

 

<apex:inputField value="{!Lead.Parent__c}" id="Parent"/>

 

I have a URL that is being generated from a workflow rule, included in an email, and sent to an external contact.  From this URL they navigate to the page that includes the above inputField.  The URL is such as....

 

http://testdomain.force.com/test?Parent=500F000000EHXs8

 

......however the field will NOT load any value nor will it pass on anything when the form is submitted.  Any help much appreciated as I am missed something obvious I think, but I cannot seem to find anything specifically for this in help anywhere.

 

 

Prafull G.Prafull G.
Since it is a reference field (Lookup/MasterDetail to Case), you can not directly pass the id and expect the value to be populated. You have to set the name, id in different query string parameters. It means you have to udpate the URL that is being generated using workflow rule.

Here is the correct URL which will populate the lookup field i.e. Parent in your case
http://testdomain.force.com/test?<FIELD ID>=TestCase&<FIELD ID>_lkid=500F000000​EHXs8

Here.. Field Id is the salesforce generated Id for Parent__c field on lead object.
NOTE: if you want to check the field Id using page view souce.. then you will get correct id which will start from CF....OR if you want to go to field and copy from URL then you have to put CF explicitly

like
CF00N20000001l3Ma
and
CF00N20000001l3Ma_lkid