Needing to copy and paste one field record into an empty column, and replace all instances of " " with "-"

Hey everyone! I’m trying to create a script that will read whatever content is placed into the first column “Product Title” and create a url handle out of it. I’m just looking for it to copy whatever record is under “Product Title” to “Handle” and replace all instances of spaces with “-” instead. Thanks so much!


use formula SUBSTITUTE(“Products title”, " ", “-”).
then turn formula field in Text(if needed)

or (if exactly script needed) use mine from here, change field names, add replacement to
rec.getCellValue(‘ source ’)

rec.getCellValue(‘ source ’).replace (/ /g,"_");
(g means all occurencies)