Try:
exportfunction btnStart_click(event){
copyRowsCount()
}
That way you were not invoking the function, just its content.
Try adding console.log() with the variables you want to check if something returned, for example:
if (allItems.length > 0) {
while(query.hasNext()) {
query = awaitquery.next()
allItems = [...allItems, ...query.items]
}
} // This is going to retrieve all the items from the Source collection.
console.log(allItems) // Check if something returned.
Also, you need to rename the collections you want to copy from and to, in my example I used ‘Source’ and ‘Destination’ because I was not sure what was the name of yours.