Expression date

I have a DateTime tag inside my UDT which I would like to be a date depending on another tag within my UDT and I had thought to use this:

forceQuality(if(hasChanged({[.]stateWatch}), coalesce(now(),0), coalesce({[.]SetDate},0)

or use another tag called currentDate which is now()

Im having problems getting this code to be accepted.