0

I have created the code to add the user record to the data extension using form given below and its working fine but Its not allowing me to use add and update both functionality to update the record of existing user into data extension using the same form and same email id of the user. Its redirecting existing user to the error page.

I tried with but its only allowing to update the record and not allowing to add.

I need both the functionality to add new user record and update existing user record to data extension into exacttarget.

   <form action="http://cl.exct.net/DEManager.aspx" name="surveyform" method="post">
    <input type="hidden" name="_clientID" value="12345678">
    <input type="hidden" name="_deExternalKey" value="surveyform">
    <input type="hidden" name="_action" value="add">
    <input type="hidden" name="_returnXML" value="0">
    <input type="hidden" name="_successURL" value="https://pub.s1.exacttarget.com/successpage">
    <input type="hidden" name="_errorURL" value="https://pub.s1.exacttarget.com/errorpage">
    <p>
        <b>Email Address: <input id="email" type="email" name="EmailID" required></b>
    </p><br />
    <input type="submit" value="Submit" class="submitBtn">
</form>
3
  • Can you pleas post your code? May 25 '17 at 17:39
  • Hi, <form action="cl.exct.net/DEManager.aspx" name="surveyform" method="post"> <input type="hidden" name="_clientID" value="12345678"> <input type="hidden" name="_deExternalKey" value="survey"> <input type="hidden" name="_action" value="add"> <input type="hidden" name="_returnXML" value="0"> <input type="hidden" name="_successURL" value="pub.s1.exacttarget.com/successpage"> May 26 '17 at 9:13
  • <input type="hidden" name="_errorURL" value="pub.s1.exacttarget.com/errorpage"> <p><b>Email Address: *(required)<input id="email" type="email" name="EmailID" required></b></p><br /> <input type="submit" value="SUBMIT" id="submitBtn"/> </form> May 26 '17 at 9:13
1

To add the new user record and update the existing, there is a function in marketing cloud as UPSERTDATA. This function checks if the user exists in data extension then updates the record else add the new record.

EXAMPLE: UpsertData("SendDE",1,"FieldName1","FieldValue1","FieldName2",""FieldValue2")

You can go through the link to know more - upsertdata function.

Parameter: used in UpsertData

SendDE -> Name of data extension from which to update specified row

1 -> Number of filter columns to insert or update

Fieldname1 -> Column name used to build the WHERE clause

Fieldvalue1 -> Value used to build the WHERE clause

Fieldname2 -> Column name used to build the INSERT clause

fieldvalue2 -> Value used to build the INSERT clause

let me know if this helps.

7
  • Thanks for the information. Could you please add the exact values that i need to add it under ( ) so that i will use that tag under the form field. Please also let me know where exactly i need to add the above code within the form. May 26 '17 at 9:06
  • UpsertData("SendDE",1,"FieldName1","FieldValue1","FieldName2",""FieldValue2") May 26 '17 at 9:13
  • 1
    This requires the code be on a landing/cloud/microsite page. It won't work with DEManager. May 26 '17 at 11:09
  • The landing page has created using cloud pages only. May 26 '17 at 11:45
  • If it's a Cloud Page, then there's no point in using DEManager. I don't recommend SmartCapture, but using the AMPScript or SSJS functions to upsert rows is the way to go. May 26 '17 at 13:26

Not the answer you're looking for? Browse other questions tagged or ask your own question.