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
niki s 7niki s 7 

How to access values in map

Hello, I am working on after trigger using old map and new map.
SToring maps values in a list like this
List<Opportunity> oppNewMap = newMap.values();
List<Opportunity> oppOldMap = oldMap.values();
Now I'd of opp in case of both oldmap and newmap will be same. 
But value are different. 
In opp there is a lookup field . And opp has a child object  product and same lookup field is also present in product obj.
Now when I update the lookup field in opp it should update the lookup field in related product. And it can have more than product.
I want to write a after trigger can anybody please help me with this.
Where I am main stuck writing soql queries on based on old values 
 
Suraj Tripathi 47Suraj Tripathi 47

Hi niki,

As Opportunity has not lookup of product so you mean to say that there is custom look field between product and opportunity.

or you are talking about OpportunityLineItem which has lookup of Opportunity and product??

Thank You!
 

niki s 7niki s 7
Talking about opportunity line items