0

I want to lookup a data extension in mobile connect optin message using Ampscript. We are sending that SMS using API call.

In my code I am looking up using mobile_number, I can see that the Mobile_Number carries a value but not able to look up a DE using that value.

Below is my sample code:

%%mobile_number%%

%%[ 

var @mobilenumber,@locale

SET @mobilenumber=mobile_number

SET @locale= Lookup("ENT._allContacts","SubscriberKey", "Mobile Number", @mobilenumber) 

]%% 

LOCALE: %%=v(@locale)=%%

Can anyone provide help on how to access Data Extensions from SMS(optin message type) using Mobile Number in where clause.

Thanks.

1 Answer 1

3

I am able to do lookup a data extension in mobile connect optin message using Ampscript. Below is my sample code:

%%[ 
   SET @idSubscriber = MOBILE_NUMBER 

   SET @rows = LookupOrderedRows("MY_DE", 1, "LANGUAGE", "MOBILE_NUMBER", @idSubscriber) 

    SET @RowCount = RowCount(@rows) 

    VAR @ILRow, @lang, @country, @locale

    SET @locale = "en_US"

    IF (Rowcount(@rows) > 0) THEN 
        VAR @ILRow, @lang, @country, @locale, @msgTitle
        SET @ILRow = row(@rows,1) 
        SET @lang = Field(@ILRow, "LANGUAGE")      
        SET @country = Field(@ILRow, "COUNTRY")
        SET @locale = Concat(@lang,"_",@country)         
    ENDIF 

]%%

Output: %%=v(@locale)=%%

You must log in to answer this question.

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