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

Custom field populate from URL parameters.



I am trying to populate a Custom Field name "Opportunity" in Case, but capture the passing parameters on the URL.  The URL above has Opportunity__C=Opt1, so basically, I want to populate "Opt1" value in the custom field name Opportunity in the new Case.


Thank you,






Instead of giving "Opportunity__c = Opt1" , use the Id of the Opportunity custom feild.


For eg.  /a0F/e?00NR0000000ZqY1={!Opportunity.Name} - where "00NR0000000ZqY1" is Id of the Custom Opportunity feild.


If the Opportunity custom feild is lookup then use, "CF00NR0000000ZqY1"


Hope this helps.





string Opportunity_1 = ApexPages.currentPage().getParameters().get('Opportunity__C');


This can get the parameter's(opportunity_c) value...


Thank you both for replied on this.


I am new to Salesforce so can you please show me quick steps how to do this.


So I have a created new Case button with this code to pass the Opportunity.ID to the new Case page when I clicked.



After the button clicked, it goes to new Case page, and the URL will be like this.


In my new Case page has a textbox called "Opportunity", how can I capture "006A0000003FnpU" then populate in the field name Opportunity with an Opportunity.Name?    Where can I put "string Opportunity_1 = ApexPages.currentPage().getParameters().get('Oppor tunity__C');"?  do I have to modify some standard class for the Case?


Thank you,


Saurabh DhobleSaurabh Dhoble

You can look at this series of posts for a better explanation on passing parameters via URL.