You need to sign in to do that
Don't have an account?
Apex Controller: get id of parent record
Hello Guys,
i have created a simple custom controller to create multipe junction records. The master object ist the opportunity object. Here is my Code
public class AddingBoostsController {
public List<BoostOpp__c > BoostList {get;set;}
public Integer rowNum{get;set;}
public AddingBoostsController(){
BoostList = new List<BoostOpp__c>();
BoostList.add(new BoostOpp__c());
}
public void insertBoost(){
insert BoostList;
}
public void insertRow(){
BoostList.add(new BoostOpp__c());
}
public void delRow(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
BoostList.remove(rowNum);
}
}
A Javascript Button is calling the visualforce Page. Now, i am looking for a solution to get the record id of the opportunity record to
1. assign it each record in the list
2. return to the master record, after the list is inserted
Is there a way to use a javascript variable in the apex code ?
Greetings Sandra
i have created a simple custom controller to create multipe junction records. The master object ist the opportunity object. Here is my Code
public class AddingBoostsController {
public List<BoostOpp__c > BoostList {get;set;}
public Integer rowNum{get;set;}
public AddingBoostsController(){
BoostList = new List<BoostOpp__c>();
BoostList.add(new BoostOpp__c());
}
public void insertBoost(){
insert BoostList;
}
public void insertRow(){
BoostList.add(new BoostOpp__c());
}
public void delRow(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
BoostList.remove(rowNum);
}
}
A Javascript Button is calling the visualforce Page. Now, i am looking for a solution to get the record id of the opportunity record to
1. assign it each record in the list
2. return to the master record, after the list is inserted
Is there a way to use a javascript variable in the apex code ?
Greetings Sandra
Pass the Opportunity Id too when you click on javascript button to call the VF page
Then access the opportunity Id in the query string as you have used in delRow method Best regards
Sampath
All Answers
Pass the Opportunity Id too when you click on javascript button to call the VF page
Then access the opportunity Id in the query string as you have used in delRow method Best regards
Sampath