I am using this code
var @rs, @row, @Id, @Fname, @Lname SET @rs= RetrieveSalesforceObjects('Lead', 'Id, FirstName,LastName', 'email', '=', @email) IF NOT Empty(@rs) THEN SET @row = ROW(@rs,1) SET @Id = FIELD(@row,"Id") SET @Fname = FIELD(@row,"FirstName") SET @Lname = FIELD(@row,"LastName") ENDIF ENDIF ]%% <div class="container"> <p> %%[ if RequestParameter("email") != "" then ]%% <p> %%=v(@Id)=%% Thank you, your preferences have been saved. (actually need to only show this on success, need error handling) </p>
I know if have two ENDIFs there but there is another IF above that I'm not showing here. My Retrieve SalesforceObjects is working fine without the IF NOT EMPTY, but with it, my other variables never get set. Why is this? I don't think it's case sensitive, but I've tried it with a number of different cases and it never works. It only works if I remove the if statement entirely. Are we not allowed to nest IF statements in Ampscript?