Assign Group to UI element via Environment variable

That capability was added to node-red 4.x. It is currently in beta. Give it a go