You can use the switch on the multiplus itself to put it in charge only mode or get a control panel to do it from a more convenient location, see manual.
You might be able to automate this with node-red and a GX device or maybe with VEconfigure using the inputs on the multiplus.
There is a remote port on the multi you can use to switch it on/off - you could use a relay for this.
Alternatively there is a softswitch on the GX under device settings, where you can change it locally via the console or remotely via VRM.
It is also fully controllable by nodered, where you can create whatever logic you like to switch the system.
If it isn’t charging, it sounds more like a configuration issue. The system needs to be configured to your requirements via Victron connect, remote configure or veconfigure.
The system is a converter, it switches between charge and invert nodes as needed but it cannot be both simultaneously.
You can force it to ether switch between charge/invert automatically as required (ON), charger only (passing through power from mains), invert only (grid is dropped) or completely OFF.
Those are the modes it supports, to customise swapping between these modes will require you to use automation.