You need to sign in to do that
Don't have an account?
Daniel K
fetch selected item from vfpage to standard page
Hi,
I have a standard Product page with few fields but here we talk about two fields:
1.Formula field with hyperlink to open vfpage on same tab.
2.Text field to hold Product name
Now, when I click on formula's hyperlink, a vf page should open and through that vfpage I should search for particular product and select one.
When I select product from vfpage, the text field in standard page should be filled with the product name.
What is the ideal way to do this without having JS in formula field's hyperlink ?
Thanks in Advance.
I have a standard Product page with few fields but here we talk about two fields:
1.Formula field with hyperlink to open vfpage on same tab.
2.Text field to hold Product name
Now, when I click on formula's hyperlink, a vf page should open and through that vfpage I should search for particular product and select one.
When I select product from vfpage, the text field in standard page should be filled with the product name.
What is the ideal way to do this without having JS in formula field's hyperlink ?
Thanks in Advance.
I didn't notice earlier but you're not passing the Id of the account to be updated to your controller, you'll need this to know whaich account to update.
you've not provided your link code used to open the visualforce page but if you update it to look something link this, you need to make sure you are giving the page the Id of the account you want to update
HYPERLINK("/apex/AccountSearch?id="+Id, "Account Search")
then update your controller, in your constructor find the Id passed to the page and use it to look up the record you have come from, then in the updateAccount method you have something to update and go back to.
All Answers
If I have this right, you have a standard page with a formula field hyperlink, when you click the link the page redirects to a visualforce page, then when you select a product on the visualforce page you want to return to the standard page and have the value set.
How to do this would depend on which version of the standard page you wish to see, the edit or the detail page, and without seeing your existing visualforce page/controller it's a little hard to tell you what's needed.
Firstly I would pass your record's Id to the Visualforce page which will tell the controller where you want to return to, your hyperlink should look something like this /apex/YourVFPage?myRecordId
then If you want to return back to the edit page I would use a URL hack to open the edit page and set the required value, there are quite a few blogs on the subject so just google Salesforce URL Hacking, here's one that really helped me out when I first started, http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html
your controller method should have something like this
If you want to return to the detail page with the selected product saved, you will need to update the record in your controller and then return to the record
I hope, from the code and screenshots you can understand what I'm trying to achieve.
Now, when I click on "Select and Go Back", I should be able to redirect and fill "Acc Name" field in standard page with account name of selected account.
Acc Name is custom field created for testing purpose only.
Thank You.
By the look of it you just want to set the name of the account to that field and be sent back to the detail page, so what we'll need is a method in your controller to update the account and then send you back to the record,
add these to your controller
then what we need to do is call our new code from the page, using a commandlink lets us call our new function and the nested param will set the account name into the selectedAccountName variable ready for the method to reference it. Here's a really good link for future use http://blog.jeffdouglas.com/2010/03/03/passing-parameters-with-a-commandlink/
If you do wish to return to the Edit screen with the field filled out and then manually click save, replace your link with this replace the FIELDID with the id of the field on the page as described in the URL hacking link (http://raydehler.com/cloud/clod/salesforce-url-hacking-to-prepopulate-fields-on-a-standard-page-layout.html)
Here should I use commandlink or outpulink ? or both ?
you can put them both on the page if you wish and then test them to see the difference, then just remove the one you don't want
Above error occurs when I click on "Select and Go Back" link on vfpage.
Pls suggest.
I didn't notice earlier but you're not passing the Id of the account to be updated to your controller, you'll need this to know whaich account to update.
you've not provided your link code used to open the visualforce page but if you update it to look something link this, you need to make sure you are giving the page the Id of the account you want to update
HYPERLINK("/apex/AccountSearch?id="+Id, "Account Search")
then update your controller, in your constructor find the Id passed to the page and use it to look up the record you have come from, then in the updateAccount method you have something to update and go back to.