Hi @SallyH,
Welcome to the Bunnings Workshop community, it is fantastic to have you with us.
Yes, you can lay drainage along a fence even if you plan to place heavy planter boxes over the top.
The key is to ensure the drainage is installed correctly to handle the load. For this application, your agi pipe should typically be buried at least 300 to 400mm deep, with a good layer of drainage gravel around 100mm thick, both underneath and around the pipe to help spread the weight and prevent crushing. Wrapping it in geotextile fabric will also help stop soil from entering and clogging the system.
Check out How to install garden drainage for an example of this style of drainage being installed.
As long as the drainage is well supported by the gravel, it should function effectively for many years.
Let me know if you have any further questions.
Jacob