I want to prepoulate Name field on opportunity with text as "System Generated".
I have written created a VF page
<apex:page standardController="Opportunity" extensions="DefaultOpprtunityNameController" action="{!redirect}"/>
and its controller as
public with sharing class DefaultOpprtunityNameController {
public DefaultOpprtunityNameController(ApexPages.StandardController controller) {
}
public PageReference redirect() {
PageReference pr = new PageReference('/006/e');
Map<String, String> m = pr.getParameters();
// Keep existing parameters
m.putAll(ApexPages.currentPage().getParameters());
// Add Opportunity name parameter
m.put('opp3', '<System Generated>');
m.put('opp11', 'Requested Info');
m.put('opp12', '25');
// Turn off the override so you go to the default UI page (and not an infinite loop)
m.put('nooverride', '1');
return pr;
}
}
And overrided standerd Opportunity "New" button with the above VF page
But I am getting an error
Error: Invalid Data.
Review all error messages below to correct your data. The page you submitted was invalid for your session. Please click Save again to confirm your change.