You need to sign in to do that
Don't have an account?
p1erre
VF:field validation before to create record
I would like to create a new ACCOUNT by first fetching the ACCOUNT details from an external data-source like a database
or a web service, then assign the details to the salesforce ACCOUNT fields and display these in the browser before
the user eventually press the SAVE button to create the account => the user should first verify if the datails are ok before to create the account.
I thougth about using the standardController Account with an extension controller for calling the external data source,
but i haven't managed to find out how to display/assign the details from my external data source to the standard salesforce ACCOUNT fields since the ACCOUNT is not yet created
or a web service, then assign the details to the salesforce ACCOUNT fields and display these in the browser before
the user eventually press the SAVE button to create the account => the user should first verify if the datails are ok before to create the account.
I thougth about using the standardController Account with an extension controller for calling the external data source,
but i haven't managed to find out how to display/assign the details from my external data source to the standard salesforce ACCOUNT fields since the ACCOUNT is not yet created
I've tried it out and it seems ok.
Now I would like to add a SAVE button in the apex page to save this accout and switch to the standard account page.
something like this:
how can I reference the account (id) from the controller ?
You don't need to write your own save method. Because you're using an extension you can use everything in the standard controller that has not been overridden by your extension. It will automatically redirect you to the detail page for your new component.
If you want it to do something different you can override your save action in your extension. You will want to save off the controller passed in to your constructor in a local variable and call controller.save(), then do whatever other logic you wanted to do.
As far as getting the id, the syntax is controller.getId(), but in your case with creating a new record, your account is not going to have an id until after you've saved it.
In my sample page I first fetch the account data defined in my controller.
After pressing the "Get fields" button the account fields are displayed on the page.
But when I then try to create the account by pressing the "save" button
no account is create
here is my sample page/controller
Does that work?
Thanks very much for your help and advices.