Open Excel System Template Specific Company filter

We have a user excel template that was created that the users want to be converted to a system excel document template. That is finished however the user template is restricted to a specific legal entity, and i’m not seeing a way to do this for the system template. Is this something I should be doing in code? Or a limitation of the system template?

A system Excel template in Dynamics 365 Finance cannot be restricted to a single legal entity. That behavior is by design, not something you can configure in the UI. If you need legal‑entity–specific behavior, you must handle it in code or through a custom extension.

That makes sense, how do I restrict this in code?