I tried a code similar to this one but it doesn't send the new password. It checks if the username exist and enters a new record in ForgottenPassword but the ForgottenPassword.NewPassword is empty and the Person.Password is the same.
It's the only process that handles forgotten password in my application.
ENTER NEW ForgottenPassword
If NOT(EXISTS Member WHERE (Member.LoginName = ForgottenPassword.LoginName)) Then REPORT ERROR 'User not found'
FIND Member WHERE Member.LoginName = ForgottenPassword.LoginName
ForgottenPassword.NewPassword = RANDOM()
Member.Password = ForgottenPassword.NewPassword
SEND ForgottenPasswordEmail TO Member
DISPLAY MESSAGE 'Your password has been sent to your email address'