Skip to main content
edited tags
Link
Lukas Lunow
  • 22.2k
  • 4
  • 27
  • 59
Source Link

How to update Data Extention row without creating a new record

i am very new for marketing cloud and I am having this problem.I have a Data Extention containig a list of Subscribers with their email and subscriber key.I build a form working well, which can post entery in to DE but i want to stop users to send this form more then once. IF the user alredy in DE must redirect to other page name : you already signed in. i have the following code but somehow create always new record insted of updating the existing record. Thanks alot for your help.

var idRows = Platform.Function.LookupRows('IDE_Form_Data','IDE_Form_Data_Key',IDE_Form_Data_Key);
            if(idRows>0) {
              Platform.Function.UpdateData("IDE_Form_Data",["IDE_Form_Data_Key"],[IDE_Form_Data_Key],["Fieldvalue_txt_1", "Form_Phone_Num", "Subscriber_Key", "Form_Id", "Form_Name", "Form_Type", "Fieldname_txt_1", "Journey_Desc", "Form_Insert_Date"],[Fieldvalue_txt_1,Form_Phone_Num,Subscriber_Key,Form_Id,Form_Name,Form_Type,Fieldname_txt_1,Journey_Desc,DateTime.SystemDateToLocalDate(Now())]);
              Platform.Response.Redirect("https://youalreadysignedinpage", false);
            } else {
              Platform.Function.InsertDE("IDE_Form_Data",["IDE_Form_Data_Key", "Fieldvalue_txt_1", "Form_Phone_Num", "Subscriber_Key", "Form_Id", "Form_Name", "Form_Type", "Fieldname_txt_1", "Journey_Desc", "Form_Insert_Date"],[IDE_Form_Data_Key,Fieldvalue_txt_1,Form_Phone_Num,Subscriber_Key,Form_Id,Form_Name,Form_Type,Fieldname_txt_1,Journey_Desc,DateTime.SystemDateToLocalDate(Now())]);
            }
            Platform.Response.Redirect("https://thankyoupage", false);