0
public static map<id,Account_Contact_Roles__c> getPrimaryContact(set<id> setSeedmanAccount)
{
    map<id,Account_Contact_Roles__c> mapdAccountContactRole = new map<id,Account_Contact_Roles__c>();
    if(setSeedmanAccount != null && setSeedmanAccount.size() > 0)
    {
        for(Account_Contact_Roles__c objAccConRole : [Select id, Account_SFID__r.id ,Contact_SFID__r.MobilePhone,Contact_SFID__r.Phone 
                                                        from Account_Contact_Roles__c 
                                                       where Account_SFID__c IN setSeedmanAccount AND Role_Descr__c = 'Primary Contact'])
        {
            mapdAccountContactRole.put(Account_SFID__r.id, objAccConRole);
        }

    }
    return mapdAccountContactRole;

}

i keep getting error "Error: Compile Error: expecting a colon, found 'setSeedmanAccount' at line 3,732 column 84"

in our case the error is at line "where Account_SFID__c IN setSeedmanAccount AND Role_Descr__c = 'Primary Contact'])"

0

While using a variable in a SOQL query you should add a : before it:

where Account_SFID__c IN :setSeedmanAccount

You can read more here: Using Apex Variables in SOQL and SOSL Queries

1
  • i got the error .thanks a lot as well as line will be like this mapdAccountContactRole.put(objAccConRole.Account_SFID__r.id, objAccConRole);
    – Samir
    Nov 20 '15 at 7:47
0

When you want to use an apex variable in a SOQL query you should put a colon(:) in front, so your query:

for(Account_Contact_Roles__c objAccConRole : [Select id, Account_SFID__r.id ,Contact_SFID__r.MobilePhone,Contact_SFID__r.Phone 
                                              from Account_Contact_Roles__c 
                                              where Account_SFID__c IN setSeedmanAccount AND Role_Descr__c = 'Primary Contact'])

would become:

for(Account_Contact_Roles__c objAccConRole : [Select id, Account_SFID__r.id ,Contact_SFID__r.MobilePhone,Contact_SFID__r.Phone 
                                              from Account_Contact_Roles__c 
                                              where Account_SFID__c IN :setSeedmanAccount AND Role_Descr__c = 'Primary Contact'])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.