Speed/Position control switching - any advice?

Speed/Position control switching - any advice?

Dear gentlemen

I have an application that I think I would like to use a function like "switch from speed to position control on the fly", let say, the axis will start with a speed command, however, when stop, it needs to switch from speed to position once receiving a trigger from the sensor. I am not sure if there is any dedicated instruction for this or if you have any better ideas kindly let me know.
Thank you very much!
Khuyen