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

Autofill Case fields with information (fields) from Opportunity?

How do you do this: I need to get information (three fields) from my Opportunity page to Case page (with those very same fields). Is it possible to some how take care of this kind of task?

For example when converting a Lead into Account and Opportunity, the fields are autofilled by the information from that Lead. Nice and easy! I would like to do something similar with Opportunity --> Case, and be able to choose which fields are needed.

Is this a piece of cake thing or what? Help needed!



If you're using a custom button,  you can use the !URLFOR function.  Here's an example of one we've used.


if you wanted to return to your original object, you can append &saveURL=%2F{!Opportunity.ID} at the end of the statement.

The code depends on the field id names in the label for= value and are dependent on your instance, if you use sandboxes.

Hey Ron929,
and thank you for your answer! I was able to solve this auto populating with URL by myself, but I copied that syntax you posted and saved that for upcoming cases.

Jimmy JuaresJimmy Juares
I have a similar question:

I am attempting to create a new Case from an Opportunity with the Opportunity field (custom field: Look Up Reference)prepopulated. I understand that there are several ways to accomplish this, but I can't find a solution, please help.

This is what I have so far:
(!URLFOR($Action.Case.NewCase, Case.Id, null, TRUE))&cas3={!Opportunity.Name}&cas3_lkid={!Opportunity.Id}

This 'Detail Page Link' results in a "URL No Longer Exists". Any Suggestions?!
here's one sample, that I was able to follow and successful populate the fields I was suppose to.


500 is 'front door' to case tab, then you have to write /e? and the field name that you want to populate via URL. With merge field you choose where from the information is coming. If you have to populate more than just one field, use & to add more.

Hope this helps you! :smileyhappy:

ps. for those who don't know it yet... use firefox plug-in to discover the field names!
Jimmy JuaresJimmy Juares
This solution worked for me. Here are the instructions in detail:

Create a new custom field in Cases: Setup>App Setup>Customize>Cases>Fields>Case Custom Fields & Relationships: New
Data Type: Lookup Relationship
Field Label: Opportunity
Related To: Opportunity
Description: Opportunity Case

Create an new S-Control: Setup>App Setup>Develop>S-Controls>New Custom S-Control.
Label: Opportunity Case
Description: Create a new Case for an Opportunity.
S-Control Name: Opportunity_Case
Type: URL
Content: /500/e?retURL=%2F{!Account.Id}&def_account_id={!Account.Id}&CF00N80000002lltQ={!Opportunity.Name}

Create a new link in Opportunity Layout: Setup>App Setup>Customize>Opportunities>Buttons and Links>Custom Buttons and Links: New
Label: Create New Case
Name: Create_New_Case
Description: Create a new Case from an Opportunity.
Display Type: Detail Page Link
Behavior: Display in a new window (make sure to disable 'Block Pop-Up Windows")
Content Source: Custom S-Control
Content: Opportunity Case [Opportunity_Case]
Remember to display this link in the Opportunity Page Layout.