Help and know-how at the Ultimaker forum post:
https://ultimaker.com/en/community/22649-automatic-top-layer-sanding
WARNING - The starting/ending Gcode it's the one I use on my machines, IT WILL 100% make the hotend crush with the bedclips, YOU must change it to your machine. If you didn't read this, sorry it's your problem. Also filament size, settings of the normal process, all, it's customized to my UMO+ with 1.75mm, FatIRobertI Bondtech, UM2+ hotend with custom fans. So EVERY setting will need to be readjusted.
Disclaimer: I share this so users with basic know-how can understand the concept, I take ZERO responsibility if you didn't read this before using the FFF on your printer.