Skip to main content

Hi there, I am trying to write some code and I get the above error. I know that the unit_price_quote_currency is a double and not a string, but how can I change the code so that it accepts a double

 

     private void getPricesAndReferences(List<Item> items) {         for (Item i : items) {             i.pricesMap = new Map<String, Double>();             i.referencesMap = new Map<String, Double>();             if (MultiQuoteConfigurations.Single_Reference__c) {                 NoOfUnitsForBeaconReference = 1;                                }             for (OpportunityLineItem opportunity_line_item : OpportunityProductsList) {                 String price_unit = (String.isNotBlank(opportunity_line_item.Equipment_Type_Pull__c)) ? opportunity_line_item.Equipment_Type_Pull__c : '-';                 if (i.isRelatedRecord(opportunity_line_item, MultiQuoteConfigurations)) {                     i.pricesMap.put(opportunity_line_item.Product2.Name + ' ' + price_unit, opportunity_line_item.Unit_Price__c != null ? opportunity_line_item.Unit_Price__c : 0);                     i.referencesMap.put(price_unit, opportunity_line_item.Unit_Price_Quote_Currency__c != null ? opportunity_line_item.Unit_Price_Quote_Currency__c  : '-');                 } else {                     i.pricesMap.put(opportunity_line_item.Product2.Name + ' ' + price_unit, 0);                     i.referencesMap.put(price_unit, '-');                 }             }         }     }

8 个回答
  1. 2022年1月9日 15:54

    No.

    You aren't fixing a typo, you're restructuring your code's data model. It's like having a house built and afterwards wanting to change something in the foundations - it's going to affect a lot of things :)

0/9000