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
Amita PatilAmita Patil 

Initial term of field expression must be a concrete SObject: Id

if(mapplcr!=null && !mapplcr.isempty()){
                    system.debug('Line187'+mapplcr);
                    system.debug('Line188'+((oplt.M_PM_Product__c).Product_Leader__c));
                    system.debug('Line189'+contmap);
                    if( mapplcr.get(oplt.M_PM_Product__c).Product_Leader__c!=null)

Please suggest how can I put the debug log , I need to see the value of (oplt.M_PM_Product__c).Product_Leader__c as I am getting null point exception, suggestion please
Best Answer chosen by Amita Patil
SalesFORCE_enFORCErSalesFORCE_enFORCEr
I think oplt.M_PM_Product__c is null. First check its value. Also add this condition in your if clause
if( mapplcr.containsKey(oplt.M_PM_Product__c) && mapplcr.get(oplt.M_PM_Product__c).Product_Leader__c!=null)

All Answers

SalesFORCE_enFORCErSalesFORCE_enFORCEr
System.debug('abc-->'+mapplcr.get(oplt.M_PM_Product__c).Product_Leader__c);
Amita PatilAmita Patil
Thanks for the reply, but I am getting null point exception at that point so i am checking the value where it is null
SalesFORCE_enFORCErSalesFORCE_enFORCEr
I think oplt.M_PM_Product__c is null. First check its value. Also add this condition in your if clause
if( mapplcr.containsKey(oplt.M_PM_Product__c) && mapplcr.get(oplt.M_PM_Product__c).Product_Leader__c!=null)
This was selected as the best answer
Amita PatilAmita Patil
Thanks again .. but how can I check the value of oplt.M_PM_Product__c , where will i put the debug log 

 below is my code:

if(lstoppteam.size()>0){ insert lstoppteam; }
        if((Trigger.isdelete && mapplcr1!=null && !mapplcr1.isempty() ) || (mapplcr1!=null && !mapplcr1.isempty() && Trigger.isupdate && Trigger.isAfter  )){
            set<id> setids = new set<id>();
            list<Opportunity_Sales_Team__c> oppsalteamlst = new list<Opportunity_Sales_Team__c>();
            for(OpportunityLineItem oplt:trigger.old){
                map<id,Opportunity_Sales_Team__c> contmap1 = new map<id,Opportunity_Sales_Team__c>();
                for(Opportunity_Sales_Team__c oppsateam :oppmap.get(oplt.Opportunityid).Opportunity_Sales_Teams__r){
                    contmap1.put(oppsateam.Contact__c,oppsateam);
                } 
                for(OpportunityLineItem oplt2:oppmap.get(oplt.Opportunityid).OpportunityLineItems){
                    setids.add(oplt2.M_PM_Product__r.Product_Leader__c);
                    setids.add(oplt2.M_PM_Product__r.Product_Line_Chief_Engineer__c);
                    setids.add(oplt2.M_PM_Product__r.Product_Line__r.Product_Line_Finance_POC__c);
                } 
                    system.debug('Line230'+mapplcr1);
                    system.debug('Line231'+((oplt.M_PM_Product__c).Product_Leader__c));
                    system.debug('Line232'+setids);
                    system.debug('Line232'+contmap1);
                if( mapplcr1.get(oplt.M_PM_Product__c).Product_Leader__c!=null
SalesFORCE_enFORCErSalesFORCE_enFORCEr
you can check its value in outer for loop.
Amita PatilAmita Patil
I have modified as below:

if(lstoppteam.size()>0){ insert lstoppteam; }
        if((Trigger.isdelete && mapplcr1!=null && !mapplcr1.isempty() ) || (mapplcr1!=null && !mapplcr1.isempty() && Trigger.isupdate && Trigger.isAfter  )){
            set<id> setids = new set<id>(); list<Opportunity_Sales_Team__c> oppsalteamlst = new list<Opportunity_Sales_Team__c>();
            for(OpportunityLineItem oplt:trigger.old){
                map<id,Opportunity_Sales_Team__c> contmap1 = new map<id,Opportunity_Sales_Team__c>();
                for(Opportunity_Sales_Team__c oppsateam :oppmap.get(oplt.Opportunityid).Opportunity_Sales_Teams__r){
                    contmap1.put(oppsateam.Contact__c,oppsateam);
                } 
                system.debug('Line231'+(oplt.M_PM_Product__c);
                for(OpportunityLineItem oplt2:oppmap.get(oplt.Opportunityid).OpportunityLineItems){
                    setids.add(oplt2.M_PM_Product__r.Product_Leader__c);
                    setids.add(oplt2.M_PM_Product__r.Product_Line_Chief_Engineer__c);
                    setids.add(oplt2.M_PM_Product__r.Product_Line__r.Product_Line_Finance_POC__c);
                } 
                    system.debug('Line230'+mapplcr1);
                    //system.debug('Line231'+((oplt.M_PM_Product__c).Product_Leader__c));
                    system.debug('Line232'+setids);
                    system.debug('Line232'+contmap1);
                if( (mapplcr1.contains(get(oplt.M_PM_Product__c).Product_Leader__c!=null)) 
SalesFORCE_enFORCErSalesFORCE_enFORCEr
 if( (mapplcr1.contains(get(oplt.M_PM_Product__c).Product_Leader__c!=null))  is wrong. It should be
 if( (mapplcr1.containsKey(oplt.M_PM_Product__c) && mapplcr1.get(oplt.M_PM_Product__c).Product_Leader__c!=null))