You need to sign in to do that
Don't have an account?
tzuvy
How to Get Case's Account ID on Apex Controller
Hi,
I'm creating a VF page that should be displayed in the case object.
I would like to retrieve information about the account in which that case resides and pass it on to the apex controller in that page.
For instance let's say my controller looks like this
public class MyController { private final Account account; public MyController() { account = [select id, name, site from Account where id = :ApexPages.currentPage().getParameters().get('id')]; } public Account getAccount() { return account; } public PageReference save() { update account; return null; } }
Becaus of the page being diplayed in the case, I can't querry for the Account ID this way
:ApexPages.currentPage().getParameters().get('id')
Since the id is not present in the case's url.
How can I pass the account ID from the case to the apex controller?
Any help will be much appreciated.
Thanks
Tzuvy
I'd probably do it like this:
All Answers
Instead of quering on account object you will have to query on case object.
Then iterate over the lstCase to retrieve the account information.
Thanks,
Devendra
Blog
Hi,
First query on Account object and then query on case object in which compare the accountid of case object with account object id
I'd probably do it like this:
Thanks this is what I was looking for