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.
%%[ 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:
- Execute all lookup functions (no matter the order they appear or if they're included within an
- Execute other function.
Any explanation why this is happening? Is there a way to get the expected output:
"Old Value" "New Value" 1