简体   繁体   English

Salesforce Apex构造函数未定义错误

[英]Salesforce Apex Constructor not defined Error

Hey I am writing a class and keep getting this Constructor not defined error. 嘿,我正在编写一个类,并不断出现此构造函数未定义的错误。 I have a Class within another class and I am doing all my queries before I start assigning fields to each of the class elements. 我在另一个类中有一个类,在开始将字段分配给每个类元素之前,我会做所有查询。

I get no errors when I am constructing the approvalQuoteLineWrapper class in the inner for loop at the end. 在最后的内部for循环中构造rovingQuoteLineWrapper类时,没有任何错误。 However when I try to construct the approvalQuoteWrapper I keep getting this error. 但是,当我尝试构造rovalingQuoteWrapper时,我一直收到此错误。

Constructor not defined: [CustomApprovalsHomeComponentController.approvalQuoteWrapper].(Id, Id, Id, Id, Id, Id, String, String, String, String, String, String, Datetime, Decimal, List) (Line: 114, Column: 23) 未定义构造函数:[CustomApprovalsHomeComponentController.approvalQuoteWrapper]。(Id,Id,Id,Id,Id,Id,String,String,String,String,String,String,String,Datetime,Decimal,List)(第114行,第Column:23)

Here is my Code: 这是我的代码:

public with sharing class CustomApprovalsHomeComponentController {

public class approvalQuoteLineWrapper{
    public approvalQuoteLineWrapper(Id quoteLineId, Id productId, String productName, Decimal listPrice, Decimal discountPercentage, Decimal netPrice, Decimal quantity, Decimal extendedPrice){
        this.quoteLineId = quoteLineId;
        this.productId = productId;
        this.productName = productName;
        this.listPrice = listPrice;
        this.discountPercentage = discountPercentage;
        this.netPrice = netPrice;
        this.quantity = quantity;
        this.extendedPrice = extendedPrice;
    }
    public Id quoteLineId {get;set;}
    public Id productId {get;set;}
    public String productName {get;set;}
    public Decimal listPrice {get;set;}
    public Decimal discountPercentage {get;set;}
    public Decimal netPrice {get;set;}
    public Decimal quantity {get;set;}
    public Decimal extendedPrice {get;set;}
}
public class approvalQuoteWrapper{
    public approvalQuoteWrapper(Id approvalId, Id quoteId, Id opportunityId, Id approverId, Id accountId, Id ownerId, String paymentTerms, String billingFreq, String quoteStatus, String oppType, String approvalStatus, String accountName, Date quoteCreateDate, Decimal totalDiscount, List<approvalQuoteLineWrapper> quoteLineList){
        this.approvalId = approvalId;
        this.quoteId = quoteId;
        this.opportunityId = opportunityId;
        this.approverId = approverId;
        this.accountId = accountId;
        this.ownerId = ownerId;
        this.paymentTerms = paymentTerms;
        this.billingFreq = billingFreq;
        this.quoteStatus = quoteStatus;
        this.oppType = oppType;
        this.approvalStatus = approvalStatus;
        this.accountName = accountName;
        this.quoteCreateDate = quoteCreateDate;
        this.totalDiscount = totalDiscount;
        this.quoteLineList = quoteLineList;
    }
    public Id approvalId {get;set;}
    public Id quoteId {get;set;}
    public Id opportunityId {get;set;}
    public Id approverId {get;set;}
    public Id accountId {get;set;}
    public Id ownerId {get;set;}
    public String paymentTerms {get;set;}
    public String billingFreq {get;set;}
    public String quoteStatus {get;set;}
    public String oppType {get;set;}
    public String approvalStatus {get;set;}
    public String accountName {get;set;}
    public Date quoteCreateDate {get;set;}
    public Decimal totalDiscount {get;set;}
    public List<approvalQuoteLineWrapper> quoteLineList {get;set;}  


}

public List<approvalQuoteWrapper> itemsToApprove {get;set;}

public CustomApprovalsHomeComponentController(){
    Map<Id, sbaa__Approval__c> approvalList = new Map<Id, sbaa__Approval__c>();
    itemsToApprove = new List<approvalQuoteWrapper>();

    for(sbaa__Approval__c items : [SELECT Id, sbaa__Approver__r.sbaa__User__c, Quote__c, sbaa__Status__c
                                 FROM sbaa__Approval__c
                                 WHERE sbaa__Approver__r.sbaa__User__c = :UserInfo.getUserID()])
    {
        approvalList.put(items.Quote__c, items);
    }



    List<SBQQ__Quote__c> quoteList = [SELECT Id, SBQQ__Account__c, SBQQ__Account__r.Name, SBQQ__Opportunity2__c, SBQQ__Opportunity2__r.Type, ApprovalStatus__c, CreatedDate, SBQQ__TotalCustomerDiscountAmount__c, OwnerId, SBQQ__PaymentTerms__c, SBQQ__BillingFrequency__c
                                 FROM SBQQ__Quote__c
                                 WHERE Id IN :approvalList.keySet() 
                                 AND ApprovalStatus__c = 'Pending'
                                 ORDER BY CreatedDate DESC];


    List<SBQQ__QuoteLine__c> quoteLineList = [SELECT Id, SBQQ__Product__c, SBQQ__Product__r.Name, SBQQ__ListPrice__c, SBCF_Approval_Discount__c, SBQQ__NetPrice__c, SBQQ__Quantity__c, SBCF_Price_per_user__c, SBQQ__Quote__c
                                 FROM SBQQ__QuoteLine__c
                                 WHERE SBQQ__Quote__c IN :approvalList.keySet()];



    for(SBQQ__Quote__c quote : quoteList){
        List<approvalQuoteLineWrapper> appQLineList = new List<approvalQuoteLineWrapper>();
        for(SBQQ__QuoteLine__c quoteLine : quoteLineList){
            if(quoteLine.SBQQ__Quote__c == quote.Id){
                appQLineList.add(new approvalQuoteLineWrapper(
                quoteLine.Id, 
                quoteLine.SBQQ__Product__c, 
                quoteLine.SBQQ__Product__r.Name, 
                quoteLine.SBQQ__ListPrice__c, 
                quoteLine.SBCF_Approval_Discount__c, 
                quoteLine.SBQQ__NetPrice__c, 
                quoteLine.SBQQ__Quantity__c, 
                quoteLine.SBCF_Price_per_user__c ));
            }
        }
        itemsToApprove.add(new approvalQuoteWrapper(
            approvalList.get(quote.Id).Id,
            quote.Id,
            quote.SBQQ__Opportunity2__c,
            approvalList.get(quote.Id).sbaa__Approver__r.sbaa__User__c,
            quote.SBQQ__Account__c,
            quote.OwnerId,
            quote.SBQQ__PaymentTerms__c,
            quote.SBQQ__BillingFrequency__c,
            quote.ApprovalStatus__c,
            quote.SBQQ__Opportunity2__r.Type,
            approvalList.get(quote.Id).sbaa__Status__c,
            quote.SBQQ__Account__r.Name,
            quote.CreatedDate,
            quote.SBQQ__TotalCustomerDiscountAmount__c,
            appQLineList));
    }
}

} }

Not Sure what I am missing. 不知道我在想什么。

Thanks in advance! 提前致谢!

Date vs DateTime 日期与日期时间

Your constructor uses a Date, you're passing in a DateTime. 您的构造函数使用Date,您传入的是DateTime。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM