1

I'm trying to write AMPscript that will take the data extension I'm mailing to and see if a record exists in a separate data ext. If it does then write to a value on one of our tables. Here's the AMPscript I'm currently using.

%%[
VAR @Subscriber_Key
SET @Subscriber_Key = _subscriberkey

SET @SOID = Lookup("Contact_Table", "SOID", "Subscriber_Key", @Subscriber_Key)

SET @Reactivate = Lookup("External_DataExt1", "SOID", "Subscriber_Key", @Subscriber_Key)

SET @PrimaryEmail = Lookup("External_DataExt2", "SOID", "Subscriber_Key", @Subscriber_Key)
]%%
<br>
<br>


%%[
IF @SOID == '%%=v(@Reactivate)=%%' then
SET @SubGoal_SL = 'Reactivate'


ELSEIF @SOID == '%%=v(@PrimaryEmail)=%%' then
SET @SubGoal_SL = 'Primary New User'

ELSE SET @SubGoal_SL = 'Successful Customer'

ENDIF
]%%
  • Hi Mike - can you please specify exactly the issue you have with your current code and what isn't working? – Brian Miller Apr 18 at 7:53
1

The v() function is only for use outside of AMPscript blocks. No need to use it inside the %%[ ]%%:

%%[

VAR @Subscriber_Key
SET @Subscriber_Key = AttributeValue("_subscriberkey")

var @SOID, @Reactivate, @PrimaryEmail
SET @SOID = Lookup("Contact_Table", "SOID", "Subscriber_Key", @Subscriber_Key)
SET @Reactivate = Lookup("External_DataExt1", "SOID", "Subscriber_Key", @Subscriber_Key)
SET @PrimaryEmail = Lookup("External_DataExt2", "SOID", "Subscriber_Key", @Subscriber_Key)

IF @SOID == @Reactivate then

    SET @SubGoal_SL = 'Reactivate'

ELSEIF @SOID == @PrimaryEmail then

    SET @SubGoal_SL = 'Primary New User'

ELSE 

    SET @SubGoal_SL = 'Successful Customer'

ENDIF

]%%
  • I will give this a try. Thanks! – Mike T Apr 17 at 18:10

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.