Print this page

Example use of Server-Side JavaScript in a Marketing Cloud landing page

Knowledge Article Number 000232465
This example code placed within a landing page or microsite will return the name of an Automation based on a Customer Key value that's input into the code by replacing the text "ExampleCustomerKey" with an External Key of one of your Automations. You can dictate what property you would like returned by replacing the "program[i].Name" code with "program[i].[Property you wish to return]"

Sample code


        <table style= "border: 1px solid black">
            <script runat=server>  
                var program = Program.Retrieve({Property:"CustomerKey",SimpleOperator:"equals",Value:"ExampleCustomerKey"});
			for (var i = 0; i < program.length; i++) 
                    		Write("<td>" + program[i].Name + "</td>");
               // Write(Stringify(program));

Want to learn more about SSJS? Review our documentation on the topic. 

promote demote