function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bheemudu neelibheemudu neeli 

Batch method does not enter into else for null value

Hi,
my code working properly but, does not entered into else block. what wrong in my code. please need help

 if (mapBRTotal.get(b.Id) != null  ){ 

            for (Bond_Reinsurance__c br :mapBRTotal.get(b.Id)){
                     If(br.Reinsurer__r.RecordType.id=='012b00000001700AAA' && br.Reinsurer__r.Trading_Partner__c==true && br.Reinsurer__r.Reinsurer_Type__c=='Facultative Out' && !(br.Reinsurer__r.Name.startsWith('OC') || br.Reinsurer__r.Name.startsWith('QS'))){
                    
                    riProportion+=br.Proportion__c;
                    grossOutstanding=b.ZGCS_Reduced_Bond_Amount__c-riProportion;
                   }
                   
             }
                   }  else
                   grossOutstanding=b.ZGCS_Reduced_Bond_Amount__c;



Thanks,
Bheem
karthikeyan perumalkarthikeyan perumal
Hello, 

Store this value in to any string value  and chekc the condition somthing like below code. also check the return value type of this mapBRTotal

public string Tempid=mapBRTotal.get(b.Id);

if(Tempid!=null)
{
}
else
{
}

Hope this will  give you some idea. 

Thanks
karthik
 
Amit Singh 1Amit Singh 1
Bheem,

Else block will be executed when list Bond_Reinsurance__c will be null for b.id otherwise it will not execute the else block.

Have you checked for this criteria?

Thanks!