Salesforce MC error:

Error 1: Script SET Statement Invalid
An error occurred when attempting to resolve a script expression. See inner exception for detail. Script Expression: Lookup("PUBLIC_SCHOOL_DISTRICT__C_SALESFORCE","Number_of_Community_Interests__c","Id",%%PublicSchoolDistrictId%%)

    %%[/* Pull the Current CIL count */
    Var @cilCount
    Set @cilCount = Lookup("PUBLIC_SCHOOL_DISTRICT__C_SALESFORCE","Number_of_Community_Interests__c","Id",%%PublicSchoolDistrictId%%)
    Count: %%= v(@cilCount) =%%

I'm not sure about my placement within the HTML email. I inserted this code inside the tag.

1 Answer 1


Try this:

/* Pull the Current CIL count */
    Var @cilCount
    Set @cilCount = Lookup("PUBLIC_SCHOOL_DISTRICT__C_SALESFORCE","Number_of_Community_Interests__c","Id",PublicSchoolDistrictId)
Count: %%=v(@cilCount)=%%

The PublicSchoolDistrictId doesn’t need the percentage signs as it’s used inside an AMPscript block. I also removed the spaces around the v function and moved your div further down. AMPscript doesn’t need to be wrapped in HTML (but it can if needed).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .