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:
%%[
VAR
@link,
@UTM,
@SubKey,
@link2
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)=%%