I used the LookupRows function in the SMS template, but when a new record with an existing ID inserts in the data extension, the SMS sent the old record info version and not the new ones. I found the LookupOrderedRows function, but when I run journey nothing happens.

The syntax was:

var @row, @rows, @fname, @location, @time
set @rows = LookupOrderedRows("1Test_SMS",1,"CreatedDate desc", "Event:Phone", MOBILE_NUMBER)
set @row = row(@rows,1)
set @fname = field(@row,"Event:First_Name__c")
set @location = field(@row,"Event:Location_Name__c")
set @time = field(@row,"Event:Start_Time__c")
Hi %%=v(@fname)=%%!  %%=v(@location)=%%  %%=v(@time)=%%.

Maybe someone knows what the problem is?

  • Everything works fine, it was problems with the marketing cloud I suppose Sep 21, 2022 at 15:26

1 Answer 1


It sounds like maybe you should restructure the data in the data extension so that you do not have multiple duplicates of the same mobile phone number. It looks like you have more than one primary key based on CreatedDate and are trying to grab the latest mobile phone number in the entry.

I would think about creating a second data extension as a history data extension to hold the duplicate mobile phone number entries and a "production" data extension solely used for the lookup. This also all depends on how the data is sourced but is one suggestion that you can look into.

  • 1
    Okay, thank you for the new info Sep 30, 2022 at 9:42
  • 1
    You can use this existing DE as that history DE and a second query that writes to a new DE to take most recent based on CreatedDate. Then perform the lookup on that new DE Sep 30, 2022 at 16:58

You must log in to answer this question.

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