You need to sign in to do that
Don't have an account?
DataSpark Analytics
Auto populate fields with default values on New record page
On a custom object, I've managed to auto populate the custom object's name field to a default value using below custom apex page code:
I have been struggling to find reference to the proper syntax. I also have been wondering how does one view all the apex codes created for a custom object, as a starting point to learn the apex coding language.
<apex:page standardController="CustomObject__c" action="{!URLFOR($Action.CustomObject__c.New, null, ['Name'='Default Value'], true)}" />Now in addition to the Name field I also want to auto populate a Master-Detail field on the Custom object but it's not working. My code:
<apex:page standardController="CustomObject__c" action="{!URLFOR($Action.CustomObject__c.New, null, ['Name'='Default Value', Master-Detail__c='Default Value'], true)}" />
I have been struggling to find reference to the proper syntax. I also have been wondering how does one view all the apex codes created for a custom object, as a starting point to learn the apex coding language.
To auto populate fields on button click, you don't need to create a visualforce page, you can just put the values in the url and its all done. Please follow the following steps:
Let's suppose you want to populate Contact Name and Account Id of Contact by clicking a button on Account:
- Create a custom button on Account, which opens a url.
- You need to get the id of the name and Account field on Contact layout, by right click and click inspect element, you will get a unique id, lets suppose ids for Name is 00N21000000NleY and for account is CF00N21000000NlZE_lkid, CF00N21000000NlZE.
- Use this url /003/e?00N21000000NleY=NeetuBansal&CF00N21000000NlZE_lkid={!Account.Id}&CF00N21000000NlZE={!Account.Name}&retURL={!Account.Id}
- This will auto populate the values.
Let me know, if you need any other help.Thanks,
Neetu
Check this link:
https://help.salesforce.com/HTViewSolution?id=000182076&language=en_US (https://help.salesforce.com/HTViewSolution?id=000182076&language=en_US)
Thanks,
Neetu
The solution you post above is useful.
Can you give any document or link with more detail?
Thanks,
Reggie.
How to populate default values in new contact?