1

I've encountered quite strange phenomena. When retrieving a field from a DE and then updating this field to some other value - the lookup which follows the update function returns the old value (before the update occurred). This is done in Cloudpages.

Example:

%%[
set @update='1000'
set @lookup1=Lookup("Test_Source_DE","test_duplicates","contactKey", '123')
set @update=UpdateData("Test_Source_DE",1,"contactKey", '123', "test_duplicates", 'New Value')

if @update=='1' then
set @lookup2=Lookup("Test_Source_DE","test_duplicates","contactKey", '123')
endif
]%%
%%=v(@lookup1)=%% <br/>
%%=v(@lookup2)=%% <br/>
%%=v(@update)=%%

The printed values are:

"Old Value"
"Old Value"
1

Notice the DE update has been indeed updated to 'New Value'. It seems like the order this ampscript block is executed is as follows:

  1. Execute all lookup functions (no matter the order they appear or if they're included within an IF condition)
  2. Execute other function.

Any explanation why this is happening? Is there a way to get the expected output:

"Old Value"
"New Value"
1

Thanks

4
  • 1
    Approximately how many rows are in the data extension you're updating? And also why are you doing a string comparison on a number -- if @update=='1'? – Adam Spriggs Dec 20 '20 at 12:34
  • 3
    SFMC has some annoying caching on small DEs that cause problems with AMPscript update functions (updateDE, updateData, claimRow, etc). It can be disabled via business rule, I believe. – Adam Spriggs Dec 20 '20 at 12:35
  • Thanks Adam. The DE has 1 row only. The if statment is only to make sure the last lookup function executed after the updatedata data function. Regarding disabling via bussiness rule - so this caching can be disabled via support case? Thanks again – Barak Dec 20 '20 at 16:11
  • Yes, via support case. I don't recall the name of the rule off the top of my head. – Adam Spriggs Dec 21 '20 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.