You need to sign in to do that
Don't have an account?
sathishsfdc
URLhack to prepopulate value to custom field
Hi,
I have a partner portal page which contains a phone number field which needs to be auto populated based on the URL..
Here s the code:
Also i have attached the screenshot.
I was trying something like this:
http://writeforce.blogspot.in/2013/01/prepopulating-fields-using-url-hacking.html
Please advise
I have a partner portal page which contains a phone number field which needs to be auto populated based on the URL..
Here s the code:
<apex:page standardcontroller="case" extensions="ContactUs" > <apex:form id="formid"> <apex:inputHidden value="{!selectedlanguageParam}" id="theHiddenInput"></apex:inputHidden> <apex:actionFunction name="languagefunction" action="{!languageSearch}" status="fetchStatus" /> <apex:pageBlock id="PbId" rendered="{!firstBlock}"> <span style="color:red;"> <apex:pagemessages /> </span> <div> <div class="headerText"> <h1 class="h1Text">{Case}</h1> </div> </div> <apex:outputpanel id="firstBlock1"> <div width="90%" cellspacing="10" cellpadding="5"> <div> <apex:outputPanel rendered="{!isReqPhNo2}"> <b class="textlabel">{!$Label.Phone_Number}</b> </apex:outputPanel> <apex:outputPanel rendered="{!isReqPhNo}"> <b class="textlabel">{!$Label.Phone_Number}<span class="required">*</span></b> </apex:outputPanel> </div> <div class="test1"> <apex:inputText id="Number" value="{!phoneNumber}" styleclass="txtbx" maxlength="35"/> </div> </div> </apex:outputpanel> </apex:page> public class ContactUs { public ContactUs(ApexPages.StandardController stdController) { csccustom=new Submit_Acase__c(); } public PageReference languageSearch(){ try{ currentRequestURL = URL.getCurrentRequestUrl().toExternalForm(); system.debug('selectedlanguageParam===='+selectedlanguageParam); PageReference p; system.debug('currentRequestURL==='+currentRequestURL); if(selectedlanguageParam=='Japanese' { if(currentRequestURL.contains('l=')) currentRequestURL = currentRequestURL.subString(0,currentRequestURL.length()-8); p = new PageReference(currentRequestURL+'?l=zh_KN } else { if(currentRequestURL.contains('l=')) currentRequestURL = currentRequestURL.subString(0,currentRequestURL.length()-8); //p = new PageReference(currentRequestURL+'?l=en_US&pageid:formid:PbId:Number=1');//--i was trying something like this p = new PageReference(currentRequestURL+'?l=en_US'); } return p; }catch(Exception ex){ } return null; }
Also i have attached the screenshot.
I was trying something like this:
http://writeforce.blogspot.in/2013/01/prepopulating-fields-using-url-hacking.html
Please advise
Once you know the id of the field you want to populate, you use <fieldId>=TextValue&_lkid=<recordId>. Using the example in the link, if the fieldId is CF00NA0000005JzZX, then the parameter is CF00NA0000005JzZX=98729921111 you need to pass in URL.
Hope this helps
thanks
shashi