0

I'm getting the error

The subscriber preview failed to generate. Review the details, correct all issues, and try again. The initial end count value for the for loop could not be cast to an integer.

when trying to go to preview and test in marketing cloud

%%[
 var @rows, @rowCount, @vendedorEmail
    set @vendedorEmail = Email
    set @rows = LookupRows("felipevendedores", "Email", @vendedorEmail)
    set @rowCount = rowcount(@rows)
]%%


     %%[
     IF @rowCount > 0 THEN
 
     FOR @i = 1 TO @rowCount DO
     set @row = ROW(@rows,@i)
 
     var @contactId, @clientName, @clientEmail 
     set @contactId = FIELD(@row,'ContactId') 
     set @clientName= field(@row,"Nome_Cliente") 
     set @clientEmail = field(@row,"Email_Cliente")
     
     set @celular = field(@row,"Celular_Cliente") 
         IF EMPTY(@celular) THEN 
         set @celular = 'Não informado'
     ENDIF ]%%

1 Answer 1

2

Looks like you're missing and endif and next @i. I'd suggest you wrap your send context assignments with AttributeValue.

%%[ 

    set @vendedorEmail = AttributeValue("Email")
    set @rows = LookupRows("felipevendedores", "Email", @vendedorEmail) 
    set @rowCount = rowcount(@rows) 

]%%

%%[

 IF @rowCount > 0 THEN

    FOR @i = 1 TO @rowCount DO

         set @row = ROW(@rows,@i)
         set @contactId = FIELD(@row,'ContactId') 
         set @clientName= field(@row,"Nome_Cliente") 
         set @clientEmail = field(@row,"Email_Cliente")
         set @celular = field(@row,"Celular_Cliente") 

         IF EMPTY(@celular) THEN 
            set @celular = 'Não informado'
         ENDIF

]%%
  <!-- HTML HERE -->
%%[

    next @i 

endif

]%%

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.