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
Peter Reid 12Peter Reid 12 

Button: Create Case on Opportunity with prepopulated field values

Hi everyone, I found this online
/500/e?retURL=%2F500%2Fo
&cas4_lkid={!Account.Id}
&cas4={!Account.Name}
&006M0000004yR7w_lkid={!Opportunity.Id}
&CF006M0000004yR7w={!Opportunity.Name}
&opp4={!Case.Account}
&CF00N00000007E8N3={!Case.CaseNumber}
&cas3_lkid={! NULLVALUE (Case.ContactId, Contact.Id )}
&cas3={! NULLVALUE (Case.Contact, Contact.Name )}
&cas6=Pre-Sale
&cas11=AE - Web
&retURL=/{!Opportunity.Id}
&saveURL=/{!Opportunity.Id}

This allows me to create a new button on Opportunity which in turn allows me to create a case on Opportunity, and relate it directly to that opportunity.  What I want to do here that I don't know is the following:

I have several fields on Opportunity object that, once I click my new button, I would like the value of those fields to be pre-populated on the new case.  This will not be a default value, this should pull the specifically selected field value.  I have identical fields on Case.  For example

Opportunity field: TEST FIELD:  1234
The value for my case field should be the same
Case field : TEST FIELD: 1234

The ultimate goal is my reps don't have to re- enter a bunch of fields that are already filled out.

Can this be done, and if so can someone give me an example of what I need to add to this button for this to work?   Thank you for any help
Peter Reid 12Peter Reid 12
Hi! Sorry I should have specified, a quick action won't work because I will have multi select picklists here, which can't be pre populated by the action
Alain CabonAlain Cabon
Ok, it is an exception indeed so you have to create a Visualforce page  called with a URL ( /apex/myNewVFP?param1=... )

Don't use the default new button but your own button New link button associated with a URL. 

https://help.salesforce.com/articleView?id=predefined_field_values_notes.htm&type=0
 
Mark Hartnady 23Mark Hartnady 23
If you are using Lightning, then URL hacking will not work. Here are some alternative resources:
https://salesforce.stackexchange.com/questions/116697/create-record-in-lightning-with-populated-fields
https://releasenotes.docs.salesforce.com/en-us/summer17/release-notes/rn_vf_defaultfieldvalues.htm
https://help.salesforce.com/articleView?id=predefined_field_values_notes.htm&type=0