You need to sign in to do that
Don't have an account?
Steven Lim 4
Hello, there's a bit of APEX syntax I keep running into but I am having trouble comprehending. What does it mean to have [(Opportunity)] in parenthesis in front of the Map instance accountIdOpportunityMap.get(a.Id)? The line I am referencing is line 5.
What type of operation is this? Is there a name for this type of code in parenthesis I can read up on? Thanks!
Question on this bit of APEX syntax
for(Account a : [SELECT Id, Most_Recently_Created_Opportunity_Name__c FROM Account WHERE Id IN :accountIdOpportunityMap.keySet()]){ a.Most_Recently_Created_Opportunity_Name__c = ((Opportunity) accountIdOpportunityMap.get(a.Id)).Name; accounts.add(a); }
Hello, there's a bit of APEX syntax I keep running into but I am having trouble comprehending. What does it mean to have [(Opportunity)] in parenthesis in front of the Map instance accountIdOpportunityMap.get(a.Id)? The line I am referencing is line 5.
What type of operation is this? Is there a name for this type of code in parenthesis I can read up on? Thanks!
In below line
a.Most_Recently_Created_Opportunity_Name__c = ((Opportunity) accountIdOpportunityMap.get(a.Id)).Name;
Base on AccountID you are getting Opportunity record from accountIdOpportunityMap and also doing type casting into Opportunity object