Bro, If you use trigger, then it will get fired on save, edit delete etc. of record. No fileds on UI will be auto populated. However, you can see the autopoulated values on record detail page. You can use formula fields, OR workflow to yo populate the values, if it is on the same object. Anyway, I am answering your question -
trigger copyFields on Contact(before insert, before update) {
for(Contact c : Trigger.new) {
// Copying Last Name into First Name.
c.firstName = c.lastName;
// You can assing static value
c.firstName = 'Your Value';
}
}
Sorry bro, You can't update lookup field using workflow, my mistake that I mentioned workflow in my previous answer. You can do the same with "process Builder".
Is it Standard visualforce page OR Custom Viaulforce page with standard controller.
Thanks,
Sumit KumarSingh
i have to create trigger
If you use trigger, then it will get fired on save, edit delete etc. of record. No fileds on UI will be auto populated. However, you can see the autopoulated values on record detail page.
You can use formula fields, OR workflow to yo populate the values, if it is on the same object.
Anyway, I am answering your question -
Hope, it will help you.
Thank,
Sumit Kumar Singh
https://developer.salesforce.com/forums/?id=906F0000000AtJ5IAK
Thanks,
Sumit Kumar Singh
http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html