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.

| improve this question | | | | |
2

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)=%%
| improve this answer | | | | |

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.