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
OyeCodeOyeCode 

Syntax Error

Can anyone plese advice what wrong in here

 

 

 Map<Id, List<ContactRoleCount__c>> contactRoleMap = new Map<Id, List<ContactRoleCount__c>>();
      List<ContactRoleCount__c> contactRolesList = new List<ContactRoleCount__c> ([SELECT ContactRoleCount__c from Opportunity where OpportunityId in : trigger.newmap.keyset() order by opportunityid]);
    // Iterate and poopulate the Map 
    for(ContactRoleCount__c crc: contactRoleMap)
    {
        //populate the list by fetching value from the map 
        List<ContactRoles__c> cr = contactRoleMap.get(crc.ContactRole__c);
           if (cr == null) {
                cr = new List<Service_Request__c>();
                contactRoleMap.put(crc.ContactRole__c, cr);
            }
            cr.add(crc); // add to the list 
    }

 

Error code

 

 Error: Compile Error: No such column 'opportunityid' on entity 'Opportunity'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name
Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Using "Opportunity" as the base entity, it should just be "Id", not "opportunityid".

All Answers

sfdcfoxsfdcfox

Using "Opportunity" as the base entity, it should just be "Id", not "opportunityid".

This was selected as the best answer
OyeCodeOyeCode

Thanks,  I just figured this out   :smileyhappy: