Photos: Sequentially Set Date Taken, Digitized, Created and Modified

Believe it or not, you already have the solution for both this problem and another one hiding after that.

Details
  1. What Leo explained: your function getString is undefined, you need to reference it from its origin like so:
    var date = clickData.func.Dlg.getString("Enter date:");
  2. Bonus problem waiting for you: after the user-cancel check (if (!date) return which you already have), but before the for loop you need to convert the string date to an Opus' Date object, so you need this:
    date = DOpus.Create().Date(date); (otherwise the date.Format call you have below would fail).