I need to retrieve a value from a data extension (DE) into the SMS message. Specifically, the GlobalID value which is the same as the contact key. The contact key is existing in the system table - all contacts. I don’t want to use any personalization string such as %%contactid%%. I need the GlobalID/ContactKey value to be associated with a variable (for example @Global = ???DE field/System Field???)

  • Name of the DE: MobileConnect_Test
  • Fields in the DE:
    • GlobalID (Text)
    • Phone (Phone)
    • Locale (Locale)
    • Name (Text)

I have used functions such as AttributeValue, lookup for the source DE, and I also tried retrieving the contact key, but nothing worked for me. When I test it out with the preview and test tool in an email, it works, but I need this to work for SMS as well. The amp script in the SMS message is below:



SET @link = URLEncode('https://www.google.com/')

SET @UTM = "?GlobalID="

SET @SubKey= AttributeValue("GlobalID") /* <--- variations of tis part are causing errors */

SET @link2 = Concat(@link, @UTM, @SubKey)


The result: %%=v(@link2)=%%
  • How are you sending the message? Send 2 DE? List send? JB?
    – EazyE
    Apr 7 '20 at 22:15

Looks like the reason why it was not working is that I have not checked the box "concatenate message". Since the amp script part was divided into more than 2 SMS messages, it was causing errors.

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.