I am trying to get the value of formula field to check in condition via customAccMap. i am checking if formula_field__c is null then i need to throw a cpqException. But on Add Product Page on CPQ i am getting "column 1: Attempt to de-reference a null object". Can anyone please help me.
public static void cannotChooseAcc(List<SBQQ__QuoteLine__c> newLines){
if(!newLines.isEmpty())
{
Set<Id> customObjectAcc = new Set<Id>();
for(SBQQ__QuoteLine__c newQL :newLines)
{
if((newQL.OppRecordTypeId__c == Label.newOppRecordTypeId__c)
customObjectAcc.add(newQL.custom_Account__c);
}
Map<Id,custom_Account__c> customAccMap = new Map<Id,custom_Account__c>([Select Id,formula_field__c from custom_Account__c where Id IN : customObjectAcc]);
if(!customAccMap.isEmpty()){
for(SBQQ__QuoteLine__c newQL :newLines){
if(customAccMap.get(newQL.custom_Account__c).formula_field__c == null) {
throw new CPQException('You cannot select this account');
}
}
}
}
}