0

I'm trying to add a row in a Data Extension using the following code:

<script runat="server">
  Platform.Load("Core","1");
  try {
        var deRows = {offer_id:"10000",title:"Test",priceForEndUser:"70000",dealer_neighborhood:"Test"};
      
        var dataExtension = DataExtension.Init("teste_offers");
   
        var dmlResult = dataExtension.Rows.Add(deRows);

        Platform.Response.Write(String(dmlResult)+'<br>');
       //Platform.Function.InsertData("teste_offers",["offer_id","title","priceForEndUser","dealer_neighborhood"],["10000","Test","70000","Test"]);
  }
  catch (ex) {
    Platform.Response.Write("An error occurred: " + ex);
  }
</script>

I'm debugging the code using Cloud Pages and the variable dmlResult always return 0 and no data is inserted.

I also tried the Platform.Function.InsertData statement but it returns me this error 'An error occurred: An error occurred when attempting to execute an InsertData function call. See inner exception for details.'

Here is my DE: Data Extension

3
  • 1
    I created the exact DE as above and used ur exact code .. and it worked!... and dmlResult returned '1'... so the code and DE look good... Can u confirm if your DE is stored locally and NOT in a shared DE? Jun 2 at 5:51
  • @VishalKumarCV Yep It's stored in this path Data Extensions > Testes > teste_offers in tha main BU. Could it be some kind of permission?
    – Leonardo
    Jun 2 at 11:27
  • Might be, as there is NO error instead you getting 0 count... its hard to debug.... I suggest to create another DE and test it. Jun 5 at 8:51

0

You must log in to answer this question.

Browse other questions tagged .