0

I am problem with the below Ampscript, this is the first step of what we want to achieve but it is not working. We are getting blank email.

%%[
var @recordID, @Email, @carRecord
set @Email = EmailAddress
set @recordID = lookup("Cars_DE","RecordID","EmailAddress", @Email)

set @carRecord = RetrieveSalesforceObjects("cars__c","Model__c,Type__c, Name","Id", "=", @recordID)


Rowcount : %%=RowCount(@carRecord)=%%

]%%

2 Answers 2

1

@ Rsuri try like this

%%[

var @recordID, @Email, @carRecord
set @Email = EmailAddress
set @recordID = lookuprows("Cars_DE","EmailAddress", @Email)

if rowcount(@recordID)>0 then
  Set @row = ROW(@recordID,1)
  Set @act = FIELD(@row,"RecordID")  
  set @carRecord = RetrieveSalesforceObjects("cars__c","Model__c,Type__c, Name","Id", "=",@act)
endif

]%%
Rowcount : %%=RowCount(@carRecord)=%%
0

I'd recommend utilizing output() to validate your variable values.

%%[

var @recordID, @Email, @carRecord, @count
set @Email = EmailAddress /* i suspect this is the issue */

output(concat("<br>email: ", @email))

set @email = AttributeValue("emailaddr")

output(concat("<br>email (from send context): ", @email))

set @recordID = lookuprows("Cars_DE","EmailAddress", @Email)
set @count = rowcount(@recordID)

output(concat("<br>count: ", @count))

if rowcount(@recordID) > 0 then

  Set @row = row(@recordID,1)
  Set @recordID = field(@row,"RecordID")
  output(concat("<br>recordID: ", @recordID))

  set @carRecord = RetrieveSalesforceObjects("cars__c","Model__c,Type__c, Name","Id", "=", @recordID)

endif

]%%
<br>Rowcount: %%=RowCount(@carRecord)=%%

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.