4

I have created a server-side javascript activity as follows. I also have a automation created via automation studio which executes the server-side script. It is succeeding each time however I don't see the update being done on the data extension. How can I debug to see the error msg?

<script  runat="server">

Platform.Load("core","1");

    try {

var caslDE = DataExtension.Init("6C119FFD-0EF5-476A-8127-E2E70D80ED04");

caslDE.Rows.Update({Source:"EXACT"}, ["Prospect Type"], ["A"]);

} catch (ex) {
    Write("An error has occurred: " + Stringify(ex));
}

</script>
  • How did you execute the server-side script from automation studio? – Bidstrup Jun 3 '16 at 9:52
4

I would put your code on a landing page, and test it that way. Like so:

%%[ 
    VAR @Result
]%%

<script  runat="server">

    Platform.Load("core","1");

    try {

    var caslDE = DataExtension.Init("6C119FFD-0EF5-476A-8127-E2E70D80ED04");

    caslDE.Rows.Update({Source:"EXACT"}, ["Prospect Type"], ["A"]);

    } catch (ex) {
        Write("An error has occurred: " + Stringify(ex));
        Variable.SetValue("@Result", Stringify(ex));  //sets above ampscript variable
    }

</script>
//// some basic page html goes here/////
%%=v(@Result)=%%
-1

I did not know how to create a landing page, then I will share a complete solution of the problem.

  1. Go to your sales force marketing cloud interface
  2. Click on "Web Studio" -> "Cloud Pages"
  3. Click on "Create Collection"
  4. Click on "Create" -> "Landing Page"
  5. Click on "Code View"
  6. Insert your script as Timothy Said

    %%[ 
        VAR @Result
    ]%%
    
    <script  runat="server">
    
        Platform.Load("core","1");
    
        try {
    
        var caslDE = DataExtension.Init("6C119FFD-0EF5-476A-8127-E2E70D80ED04");
    
        caslDE.Rows.Update({Source:"EXACT"}, ["Prospect Type"], ["A"]);
    
        } catch (ex) {
            Write("An error has occurred: " + Stringify(ex));
            Variable.SetValue("@Result", Stringify(ex));  //sets above ampscript variable
        }
    

  7. Click "save"

  8. Click "schedule/publish" and wait until your preview is ready.

Your Answer

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

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