1

I am stuck with a compile time error "Initial term of field expression must be a concrete SObject:Id"
If the Totalcontracts are greater than 1 then it is failing. For multiple contracts with different terms I am using the billing term from the primary contract. Suppose there are 3 contracts with terms 3, 6, 12 and you select first two contracts with terms 3, 6 and make the second contract as primary contract.The primary contract is stored in contractId which is in the argument.

Can anyone help me where i am wrong and how to proceed?

public static Apttus_Proposal__Proposal__c onQuoteStart(Id contractId, Set<Id> contractIdList) {
          Apttus_Proposal__Proposal__c quote = new Apttus_Proposal__Proposal__c();
          String contractNumbers = '';
          Contract contract = [SELECT  Id,ContractNumber,sfbase__Billing_Term__c FROM contract WHERE Id=:contractId];
          List<Contract> contractList = new List<Contract>();
          List<Contract> fetchedLstOfContracts = new List<Contract>();
          contractList.add(contract);
          Integer totalContracts = contractIdList.size();

          if (totalContracts == 1) {
            contractNumbers = contract.ContractNumber;
          } else{
              fetchedLstOfContracts = [SELECT  Id,Name,ContractNumber FROM Contract WHERE Id in :contractIdList];
              contractList.addAll(fetchedLstOfContracts);
              for(Contract con : contractList) {
                contractNumbers += (con.ContractNumber + ';');
              }
          }

          if (totalContracts == 1 ){
                            system.debug('@@@@Entered SingleContract Loop');
                            system.debug('@@@@BillingTerm:'+contract.sfbase__Billing_Term__c);
                            quote.SfdcContracts_Reduced__c = contract.ContractNumber;
                            quote.SfdcBillingTerm__c = contract.sfbase__Billing_Term__c; 
          }
          else if(totalContracts > 1 ){
                        system.debug('####Entered MultiContract Loop'); 
                        system.debug('####BillingTerm:'+contractId.sfbase__Billing_Term__c);           
                        quote.SfdcContracts_Reduced__c = contractNumbers;
                        quote.SfdcBillingTerm__c = contractId.sfbase__Billing_Term__c; 
          }
}
3

Here's your problem:

contractId.sfbase__Billing_Term__c

You should reference the entire record to pull a specific field value, not reference its Id:

contract.sfbase__Billing_Term__c

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.