// Switch all beacons from one business to another fromBiz = 17; // In-N-Out toBiz = 27; // Big Dean's queryExecute(" UPDATE lt_Beacon_Businesses_ServicePoints SET BusinessID = :toBiz WHERE BusinessID = :fromBiz ", { toBiz: toBiz, fromBiz: fromBiz }, { datasource: "payfrit" }); // Get current state q = queryExecute(" SELECT lt.*, b.BusinessName FROM lt_Beacon_Businesses_ServicePoints lt JOIN Businesses b ON b.BusinessID = lt.BusinessID ", {}, { datasource: "payfrit" }); rows = []; for (row in q) { arrayAppend(rows, { "BeaconID": row.BeaconID, "BusinessID": row.BusinessID, "BusinessName": row.BusinessName, "ServicePointID": row.ServicePointID }); } writeOutput(serializeJSON({ "OK": true, "MESSAGE": "Switched beacons from BusinessID #fromBiz# to #toBiz#", "MAPPINGS": rows }));