1

I try to retrieve the following fields: UID_TARGET(From All subscribers), LAST_VISIT_DATE (From Data Extension), LAST_STATION_TYPE (From Data Extension) in the URL after clicking on the button submit. When I add the AMPScript code at the page level (text) display a error message. and, when I use the code amp script at the button, it does not retrieve the data.

AMPScript Code :

%%[
var @last_visite_date, @UID, @last_station_type
 SET @UID = [UID_TARGET] 
 SET @last_visite_date = Lookup("ENT.ACTIVITY_LOT_6","LAST_VISITE_DATE","UID_TARGET", @UID) 
 SET @last_station_type = Lookup("ENT.ACTIVITY_LOT_6","LAST_STATION_TYPE","UID_TARGET", @UID) 
]%% 

URL example:

href="http://www.exempledomaine.com/fr-BE?CustomerId=%%UID_TARGET%%&refuelDate=%%=v(@last_visite_date)=%%&stationId=%%=v(@last_station_type)=%%&source=mailing"
1
  • You are declaring @UID twice, remove the second. On the fr-BE page retrieve the parameters with: SET @ UID = RequestParameter("CustomerID"). Jun 22, 2017 at 13:52

1 Answer 1

1

You can do like this

AMPSCRIPT CODE:

%%[
var @last_visite_date, @UID, @last_station_type
 SET @UID = [UID_TARGET] 
 SET @lookup = Lookuprows("ENT.ACTIVITY_LOT_6","UID_TARGET", @UID) /*do a lookuprows with UID*/
 If RowCount(@lookup) > 0 Then /*check the row count*/
    set @row = row(@lookup, 1)
    set @last_visite_date = field(@row, "LAST_VISITE_DATE") /*fetch the value from field name*/
    set @last_station_type = field(@row, "LAST_STATION_TYPE") /*fetch the value from field name*/
 endif

SET @url = "http://www.exempledomaine.com/fr-BE"
SET @concatURL = concat("http://www.exempledomaine.com/fr-BE?CustomerId=",@UID,"&refuelDate=",@last_visite_date,"&stationId=",@last_station_type,"&source=mailing")
]%% 

URL Exmaple:

href="%%=redirectto(@concatURL)=%%"

visit redirectto and lookuprows to know more about this functions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .