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
Ancil PAAncil PA 

Auto populate the value of CustomerName field in case screen

I am trying to auto populate the value of CustomerName field in case screen as "Anonymous" based on recordtype selection. Can somebody help me on this? 

I tried using workflow but  i am not getting the CustomerName field in case object and i could find that the CustomerName field is related to account object, due to which i am unable to use workflow to auto populate the value of CustomerName field in case screen.
Best Answer chosen by Ancil PA
HARSHIL U PARIKHHARSHIL U PARIKH
I think this requirs you to do the magic of URL hacking if you are in Salesforce classic.

You need to create a new button which opens up the child record from parent records' related list section and then auto populates the parent field (whichever you would like).


Example: Auto populate a Account name field on Contact's Account_Name_Custom__c field.

Account_Name_Custom__c is a new custom field on a contact record which would be auto populated as its account name.

You need to create a button on contact object (child object in your case) which would look like following,

User-added image



Once done, you need to populate this button on page layout of an Account (parent object in your case)

Let's break down the code: /003/e?retURL=%2F{!Account.Id}&accid={!Account.Id}&00N1I00000L7Yvh={!Account.Name}
 
/003/e?retURL=%2F{!Account.Id}&accid={!Account.Id}&00N1I00000L7Yvh={!Account.Name}


/003/e? 
is a characters which auto populates when you normally create a child record from a parent related list. so copy /003/e? to your own.

retURL=%2F{!Account.Id}&accid={!Account.Id}
Instead of Account.Id put your own Parent_Object__c.Id
instead of accId put a lookup your own lookup field of child which is looking up to the parent.

&00N1I00000L7Yvh
00N1I00000L7Yvh is the field you want to populate. Its a field ID. It can be found by simply going to the field and COPY it from URL

={!Account.Name}
instead of Account.Name put your object's value. Maybe Parent_Object__c.Name

Take a look at the following screens as well. That is a result for our example above

User-added image



User-added image

Hope this helps & if it resolves the issue, please mark it as Best Answer!

Useful link: http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html (http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html)