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

Its urgent requriment
Hi experts,
i have custom object called deal and standard object called oppotuntiy i created button called convert when i click on that deal has to convert in to opporuntiy its working fine now but my requirement is that
Once the deal converts to Opportunity transfer this benefit information to the Opportunity and apply deal benefits to Opportunity Line Items.
In opportuniy there is two custom fileds called %incentive and Doller incentive those benefits has to assign only these twoo filds and agian deal benefits to opportunity lineitem
This is my apexcode:
public with sharing class MyDealControllerExtension {
public ApexPages.StandardController CONTROL;
public MyDealControllerExtension(ApexPages.StandardController stdController) {
this.CONTROL = stdController;
}
public pageReference doCreateOpportunity() {
Opportunity newOpp = new Opportunity();
Deal__c Deal = [select Id, Name, Distributor__c, End_Customer__c, Industry__c, Partner_Specializations__c,Partner_Tier__c,Product_Category__c,Segment__c from Deal__c where id = :CONTROL.getId()];
// add your field mappings here
newOpp.Name = Deal.Name;
newOpp.stagename = 'Negotiation/Review';
newOpp.CloseDate= system.today()+30;
Deal.Deal_Status__c = 'Converted';
// etc.
insert newOpp;
pageReference p = new pageReference('/' + newOpp.id);
p.setRedirect(true);
return p;
}
public ApexPages.StandardController CONTROL;
public MyDealControllerExtension(ApexPages.StandardController stdController) {
this.CONTROL = stdController;
}
public pageReference doCreateOpportunity() {
Opportunity newOpp = new Opportunity();
Deal__c Deal = [select Id, Name, Distributor__c, End_Customer__c, Industry__c, Partner_Specializations__c,Partner_Tier__c,Product_Category__c,Segment__c from Deal__c where id = :CONTROL.getId()];
// add your field mappings here
newOpp.Name = Deal.Name;
newOpp.stagename = 'Negotiation/Review';
newOpp.CloseDate= system.today()+30;
Deal.Deal_Status__c = 'Converted';
// etc.
insert newOpp;
pageReference p = new pageReference('/' + newOpp.id);
p.setRedirect(true);
return p;
}
Vf page:
<apex:page standardController="Deal__c" extensions="MyDealControllerExtension" action="{!doCreateOpportunity}" />
I went through ur post and i did not under the following thing, can u please add some explination on the following lines.
HI suree,
ya u have to apply deal benefits to the opportuntiy and one more thing is that %incentive and doller incentive are not there in the deal object we have to fetch from the deal process association(object) which is child object of deal , and we have to map deal process association and opportunity in our coding and we have to fetch the information from deal project association and we have to store in opportunity custom objects that is %inentive and doller incentive , and we have to apply all deal benefits to opportunity products.
as i posted im not getting what they saying in my company what ever prsent in blue lines these lines told me by my lead so pls check it out once and tell me the requirement that is once deal is converted into opportunity
Once the deal converts to Opportunity transfer this benefit information to the Opportunity and apply deal benefits to Opportunity Line Items.
hi
deal process associate is the child object of deal in deal process associate there are fields that is %incentive and doller incentive so we have to fetch those and have to store in opportunity custom fields i mean these two fields doller incentive and %incentive are prsent in opportunity also , we have to write query to fetch the records on the child object that is deal process associate for that when you need to search for fields of a child record, create a query for child records in the class and in that follow the in matrix for benefit type calculation
apexcode :
public ApexPages.StandardController CONTROL;
public MyDealControllerExtension(ApexPages.StandardController stdController) {
this.CONTROL = stdController;
}
public pageReference doCreateOpportunity() {
Opportunity newOpp = new Opportunity();
Deal__c Deal = [select Id, Name, Distributor__c, End_Customer__c, Industry__c, Partner_Specializations__c,Partner_Tier__c,Product_Category__c,Segment__c from Deal__c where id = :CONTROL.getId()];
// add your field mappings here
newOpp.Name = Deal.Name;
newOpp.stagename = 'Negotiation/Review';
newOpp.CloseDate= system.today()+30;
Deal.Deal_Status__c = 'Converted';
// etc.
insert newOpp;
pageReference p = new pageReference('/' + newOpp.id);
p.setRedirect(true);
return p;
}