You need to sign in to do that
Don't have an account?
Pavan Renjal
Error: Compile Error: Initial term of field expression must be a concrete SObject: Object
I have a map consisting of Id and Double as Key and Value Pair. I am trying to assign a custom field in Opportunity to the value from Map. I have already added the values to the Map (not shown in the piece of code below) but i am failing to add the values to custom field Total_Price__c in Opportunity. Can anyone please help me in achieveing this? The syntax used below might be wrong, being a newbie i have no clue as how to execute this.
Map<Id,Double> MapTotalPrice = new Map<Id,Double>(); Opportunity Opp = new Opprtunity(); List<Opportunity> OpportunityList = new List<Opportunity>(); for(Id OppId: MapPrice.KeySet()) { Opp.get(OppId).Total_Price_c = MapTotalPrice.get(OppId); OpportunityList.add(Opp); } update OpportunityList;
List<Opportunity> OpportunityList = new List<Opportunity>();
Sorry that was just a typo i made while posting this thread, i have used it correctly in my trigger.
It would be helpful if you can let me know what i need to do in order to add values from Map to Custome Field Total_Price__c in Opportunity which is of type Currency.
opp = new Opportunity(Id = oppId)
opp.Total_Price__ = MapPrice.get(OppId);
OpportunityList.add(opp);
No need to initialize the opp outside the loop.
Thanks a bunch! Worked like a charm!