Method does not exist or incorrect signature: void getRelatedQuoteMap(Id, Set<Id>) apex…
- User
Method does not exist or incorrect signature: void getRelatedQuoteMap(Id, Set) apex error in salesforce
- Assistant
This error occurs when the method
getRelatedQuoteMap()doesn't exist in the specified Apex class or the method signature is not correct.To fix the error, you need to verify that the method
getRelatedQuoteMap()is defined in the Apex class and the parameters are correct. Additionally, check the method access modifier and visibility to ensure that it's accessible from where it's being called. - User
public class IPSolutionMergedQuoteController { public String primaryQuote{get;set;} public String quoteName{get;set;} public String relatedquoteName{get;set;} public String quoteNumber{get;set;} public String opportunity{get;set;} public String status{get;set;} public Date startDate{get;set;} public String billToName{get;set;} public String soldToName{get;set;} public String selectedQuote{get;set;} public List pQuoteName{get;set;} public List npQuoteList{get;set;}
public IPSolutionMergedQuoteController(ApexPages.standardcontroller std){ Id oppId=ApexPages.currentPage().getParameters().get('Id'); List<Opportunity> oppList = [SELECT ID,Name,Quotes__c,(SELECT Id,Name,zqu__Number__c,zqu__Opportunity__c,zqu__Status__c,zqu__StartDate__c, zqu__BillToContact__r.Name,zqu__SoldToContact__r.name,zqu__Primary__c,Related_Quote__c FROM zqu__Quotes__r) FROM Opportunity WHERE Id=:oppId]; List<zqu__Quote__c> quoteList=[SELECT Name,Id,zqu__Primary__c,Related_Quote__c,zqu__Number__c,zqu__Opportunity__c, zqu__Status__c,zqu__BillToContact__r.Name,zqu__BillToContact__r.firstName, zqu__SoldToContact__r.name,zqu__StartDate__c,zqu__BillToContact__r.lastName, zqu__SoldToContact__r.firstName,zqu__SoldToContact__r.lastName FROM zqu__Quote__c WHERE zqu__Opportunity__c=:oppList]; set<id> prmaryIds = new set<id>(); List<PrimaryQuoteWrapper> qwList = new List<PrimaryQuoteWrapper>(); List<NonPrimaryQuoteWrapper> nonPrimary = new List<NonPrimaryQuoteWrapper>(); Map<Id, List<NonPrimaryQuoteWrapper>> relatedQuoteMap = getRelatedQuoteMap(oppId, prmaryIds); for(Opportunity opp:oppList){ for(zqu__Quote__c qu:quoteList){ if(qu.zqu__Primary__c==true && qu.zqu__Primary__c!=null){ prmaryIds.add(qu.Id); string quoteName; quoteName = qu.Name; selectedQuote = qu.Id; PrimaryQuoteWrapper pqw = new PrimaryQuoteWrapper(quoteName); qwList.add(pqw); } /*if(qu.Related_Quote__c==selectedQuote && qu.Related_Quote__c!=null){ String relatedquoteName; relatedquoteName=qu.Related_Quote__c; String quoteNumber; if(qu.zqu__Number__c!=null){ quoteNumber = qu.zqu__Number__c; } String opportunity; if(qu.zqu__Opportunity__c!=null){ opportunity = qu.zqu__Opportunity__c; } String status; if(qu.zqu__Status__c!=null){ status=qu.zqu__Status__c; } Date startDate; if(qu.zqu__StartDate__c!=null){ startDate = qu.zqu__StartDate__c; } String billToName; if(qu.zqu__BillToContact__r.firstName!=null && qu.zqu__BillToContact__r.lastName!=null) { billToName=qu.zqu__BillToContact__r.firstName+' '+ qu.zqu__BillToContact__r.lastName; } String soldToName; if(qu.zqu__SoldToContact__r.firstName!=null && qu.zqu__SoldToContact__r.lastName!=null) { soldToName=qu.zqu__SoldToContact__r.firstName+' '+ qu.zqu__SoldToContact__r.lastName; } NonPrimaryQuoteWrapper nPQW = new NonPrimaryQuoteWrapper(relatedquoteName,quoteNumber,opportunity,status, startDate,billToName,soldToName,selectedQuote); nonPrimary.add(nPQW); }*/ } pQuoteName = qwList; //npQuoteList = nonPrimary; system.debug('pQuoteName'+pQuoteName); //system.debug('npQuoteList'+npQuoteList); } } public class PrimaryQuoteWrapper{ Public String quoteName{get;set;} PrimaryQuoteWrapper(String quoteName){ this.quoteName=quoteName; } } public class NonPrimaryQuoteWrapper{ public String relatedquoteName{get;set;} public String quoteNumber{get;set;} public String opportunity{get;set;} public String status{get;set;} public Date startDate{get;set;} public String billToName{get;set;} public String soldToName{get;set;} public String selectedQuote{get;set;} NonPrimaryQuoteWrapper(String relatedquoteName,String quoteNumber,String opportunity,String status,Date startDate, String billToContact,String soldToContact,String selectedQuote){ this.relatedquoteName=relatedquoteName; this.quoteNumber=quoteNumber; this.opportunity=opportunity; this.status=status; this.startDate=startDate; this.billToName=billToName; this.soldToName=soldToName; this.selectedQuote=selectedQuote; } } //show related primary quote list on the table Private static Map<Id, List<NonPrimaryQuoteWrapper>> getRelatedQuoteMap(Id oppId){ Map<Id, List<NonPrimaryQuoteWrapper>> quoteIdToRelatedQuoteId = new Map<Id, List<NonPrimaryQuoteWrapper>>(); List<zqu__Quote__c> relatedQuoteList = [SELECT Name,Id,zqu__Primary__c,Related_Quote__c,zqu__Number__c,zqu__Opportunity__c, zqu__Status__c,zqu__BillToContact__r.Name,zqu__BillToContact__r.firstName, zqu__SoldToContact__r.name,zqu__StartDate__c,zqu__BillToContact__r.lastName, zqu__SoldToContact__r.firstName,zqu__SoldToContact__r.lastName FROM zqu__Quote__c WHERE zqu__Opportunity__c=:oppId AND Related_Quote__c=:prmaryIds]; return quoteIdToRelatedQuoteId; }} error is prmaryIds is doesn't exist please resolve this one
- Assistant
The variable
prmaryIdsseems to be declared in the constructor of theIPSolutionMergedQuoteControllerbut is not being passed to thegetRelatedQuoteMap()method.To fix the issue, you can pass the
prmaryIdsvariable to thegetRelatedQuoteMap()method as shown below:Map<Id, List<NonPrimaryQuoteWrapper>> relatedQuoteMap = getRelatedQuoteMap(oppId, prmaryIds);And update the method signature to include the
prmaryIdsparameter:Private static Map<Id, List<NonPrimaryQuoteWrapper>> getRelatedQuoteMap(Id oppId, Set<Id> prmaryIds){ // code implementation } - User
Method does not exist or incorrect signature: void add(Map<Id,List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>) from the type List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>
- Assistant
This error message is shown when you are trying to add a
Map<Id,List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>object to aList<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>object.You cannot add a map to a list as they are completely different data types. To resolve this error, check your code and make sure that you are using the correct data type for the add() method.
If you want to add a
NonPrimaryQuoteWrapperobject to the list, you can simply use the.add()method as shown below:List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper> nonPrimary = new List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>(); Map<Id,List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>> quoteIdToRelatedQuoteId = new Map<Id,List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>(); nonPrimary.add(new IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper(/* pass the required parameters */));If you want to add a
Map<Id,List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>object to another map object, you can use the.putAll()method as shown below:Map<Id, List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>> mapObj1 = new Map<Id, List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>(); Map<Id, List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>> mapObj2 = new Map<Id, List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>(); mapObj1.putAll(mapObj2);Ensure that you are using the
.add()method for lists and.putAll()method for maps to resolve this error. - User
Illegal assignment from List<List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>> to List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>
- Assistant
This error message is shown when you are trying to assign a
List<List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>object to aList<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>object.These data types are different, and you cannot assign one to the other. To resolve this error, you need to update the code and ensure that you are assigning the correct data type.
If you want to store the elements of the
List<List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>object into a single list, you can use theaddAll()method to concatenate the lists together. This will create a single list with the elements from all the nested lists.Here's an example of how to use the
addAll()method to concatenate the nested lists:List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper> nonPrimary = new List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>(); List<List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>> nestedList = new List<List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper>>(); // Populate the nested list here for (List<IPSolutionMergedQuoteController.NonPrimaryQuoteWrapper> tempList : nestedList) { nonPrimary.addAll(tempList); }This code will iterate over each nested list in the
nestedListobject, and add all the elements to thenonPrimarylist using theaddAll()method.