Salesforce Apex 构造函数未定义错误
Salesforce Apex Constructor not defined Error
嘿,我正在写 class 并不断收到此 Constructor not defined 错误。我在另一个 class 中有一个 Class,在开始为每个 class 元素分配字段之前,我正在执行所有查询。
当我在最后的内部 for 循环中构造 approvalQuoteLineWrapper class 时,我没有收到任何错误。但是,当我尝试构建 approvalQuoteWrapper 时,我不断收到此错误。
构造函数未定义:[CustomApprovalsHomeComponentController.approvalQuoteWrapper].(Id, Id, Id, Id, Id, Id, String, String, String, String, String, String, Datetime, Decimal, List)(行: 114, 列: 23)
这是我的代码:
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));
}
}
}
不确定我错过了什么。
提前致谢!
日期与日期时间
您的构造函数使用日期,您传入的是日期时间。
嘿,我正在写 class 并不断收到此 Constructor not defined 错误。我在另一个 class 中有一个 Class,在开始为每个 class 元素分配字段之前,我正在执行所有查询。
当我在最后的内部 for 循环中构造 approvalQuoteLineWrapper class 时,我没有收到任何错误。但是,当我尝试构建 approvalQuoteWrapper 时,我不断收到此错误。
构造函数未定义:[CustomApprovalsHomeComponentController.approvalQuoteWrapper].(Id, Id, Id, Id, Id, Id, String, String, String, String, String, String, Datetime, Decimal, List)(行: 114, 列: 23)
这是我的代码:
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));
}
}
}
不确定我错过了什么。
提前致谢!
日期与日期时间
您的构造函数使用日期,您传入的是日期时间。