Below is another example of using Async / Await in script. Note there are no callbacks, or then() methods used and the script appears to be synchronous with one line of code executed after another.
This script is intended to be pasted into the console as indicated below:
Notes:
(1) To makes short demos that require as little maintenance on my part as possible I have to use a few tricks. So to indicate that the Cast fields is being updated each time the console script is run I simply pick a random delimiter to separate the concatenated cast members.
(2) It goes without saying that the report is only valid immediately after the script is run as the concatenated child records wold change at any time.
(3) Like the other Async / Await example we are intentionally calling API_EditRecord multiple times rather than calling API_ImportFromCSV to effectuate our changes.
(4) How you get this script to run is a workflow decision unique to your application and usage. You will need to bind the script to a button placed somewhere in your application (on the home page, report or form perhaps).