I am trying to write a script that will start (or stop) multiple programs in one go. I have stored a list of programs in a data extension (BUList) that has the columns BU and MID. The programs are named using the following pattern, where [MID] should be substituted with the corresponding value held in the DE: Dev - [MID] - Audience Builder Program. Each program is in the business unit of the corresponding MID. I have written the following script but it errors out each time. Is there a way to accomplish this task?
<script runat="server">
var status = [null, null, null];
var row;
var i;
var rows = Platform.Function.LookupOrderedRows('BUList', 0, 'MID desc',,);
for i = 1 to RowCount(rows) do
{
row = Row(rows,i);
var program = Platform.Function.CreateObject('Campaign');
Platform.Function.SetObjectProperty(program, 'CustomerKey', 'Dev - ' + Field(row, 'MID') + ' - Audience Builder Program');
Platform.Function.InvokePerform(program, 'start', status, null);
next i;
}
</script>