0

I need to show a content area if there is more than one row in a specific table, and other content area if there is only one row in this table.

It’s not possible to consult Synchronized Data Extensions from Salesforce using AMPscript, and I can’t use the Journey Builder Data Extension because I need to see the current data value about the subscribers, and the Journey DE only provides the initial data value of subscribers.

I’m trying to use lookup rows with Retrieve Salesforce Objects using it as a table to do a rowcount with its result.

I validate the email in Content Builder and it doesn’t show any problem, but when I activate the Journey, my contacts don’t recieve the email.

Am I missing something? Is there a way to resolve this? I’m using the code below:


Like Adam said I had unnecessary lookuprows, only post this because I need to add the ID filter in the retrivesalesforceobjects

%%[

set @nomejob = AttributeValue("Questionario__c:Nome_Job_simplificado__c")
set @id = AttributeValue("Questionario__c:Pesquisador__c")
set @rs = retrievesalesforceobjects('Questionario__c','Pesquisador__c,Status_anterior_do_questionario__c,Status_do_Questionario__c','Status_anterior_do_questionario__c','=','Em Treinamento','Status_do_Questionario__c','=','Expirado','Pesquisador__c',`=`,@id)

set @rowcount = rowcount(@rs)

if @rowcount > 1 then 

]%%

CONTENT 1

%%[ else ]%%

CONTENT 2

%%[endif]%%
0

There's no need to do an additional lookupRows() in your rowCount() function.

%%[

set @nomejob = AttributeValue("Questionario__c:Nome_Job_simplificado__c")
set @id = AttributeValue("Questionario__c:Pesquisador__c")
set @rs = retrievesalesforceobjects('Questionario__c','Pesquisador__c,Status_anterior_do_questionario__c,Status_do_Questionario__c','Status_anterior_do_questionario__c','=','Em Treinamento','Status_do_Questionario__c','=','Expirado')

set @rowcount = rowcount(@rs)

if @rowcount > 1 then 

]%%

CONTENT 1

%%[ else ]%%

CONTENT 2

%%[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.