You need to sign in to do that
Don't have an account?
Prepopulating Standard object pages from Visualforce (Wizard)
Hi,
I'm trying to avoid building a Visualforce page for something where the regular Salesforce pages would ordinarily work fine.
I start out a simple wizard with a VF page with a few Account fields. I want to then create a child record in Meeting_Notes__c and I want the Account__c field filled in and the rest blank for editing.
I thought the following excerpt should work to achieve this, meaning create a new Meeting_Note__c in the controller, add Account.Id, and then pass it to the page reference.
Instead of bringing up a new Meeting_Notes__c page, it's bringing up the Account page. I know I can solve this easily by marking up the entire page in Visualforce but I feel that if the page is already good without using VF, to not use VF.
Is there some little tiny mistake I'm making?
public PageReference next() { Meeting_Note__c mn = new Meeting_Note__c(Account__c = acct.Id); PageReference mnPage = new ApexPages.StandardController(mn).edit(); mnPage.setRedirect(true); return mnPage;
Until a record is saved, it doesn't have an edit page. The following worked for me (note the call to save()):
I was afraid of that actually. I really just want to put them on a new record page with whatever values I decide to pass prepopulated, and leave it up to the user as to whether they hit save or if they decide to cancel.
I'm afraid if I hit save, with only the one or two prepopulated values, that Workflow will kick off which shouldn't happen till all required fields are filled in.
To my knowledge, there isn't a way to do that with a standard New page; you'd need to create a VF page for the new record as well.