You need to sign in to do that
Don't have an account?

How to prepopulate opportunity name in quote visualforce page
Hi,
I have done visualforce page for satndard quote.I want to prepopulate opportunity name in this visualforce page.
Can any one give idea.
Thanks in advance
If you are using a StandardController in your constructor parameters, you could do the following:
public with sharing class TestClass
{
public Opportunity opp {get; private set;}
private Quote q;
public TestClass(ApexPages.StandardController stdController)
{
q = (Quote)stdController.getRecord();
opp = [Select Id, Name From Opportunity Where Id =: q.OpportunityId];
}
}
This gets the Quote from the page, regardless of if it is on a create new or edit action, and pulls the parent (Opportunity) in for you. You just have to query to get other fields, in this case Name. This should work and I hope it helps.
All Answers
If you are using a StandardController in your constructor parameters, you could do the following:
public with sharing class TestClass
{
public Opportunity opp {get; private set;}
private Quote q;
public TestClass(ApexPages.StandardController stdController)
{
q = (Quote)stdController.getRecord();
opp = [Select Id, Name From Opportunity Where Id =: q.OpportunityId];
}
}
This gets the Quote from the page, regardless of if it is on a create new or edit action, and pulls the parent (Opportunity) in for you. You just have to query to get other fields, in this case Name. This should work and I hope it helps.
Thanks for ur reply,
Its working....