Custom behavior in document download

Greetings everyone,

I am tasked to implement some custom behavior in response to a click on a document link.
The link provided by SuiteCRM is like the following one:

http://<<partial_url>>/index.php?entryPoint=download&id=<<doc_id>>&type=<<my_custom_module>>

Is there a way of customizing the default behavior? (which in this case is the plain download of the locally stored file)
Should I try overriding the existing logic or should I implement a new entry point from scratch?
And if so, how can I have the UI provide the correct url to the user?


Environment information: Apache 2.4.17, PHP 5.6.23

Check here to see where the entrypoint maps to:

include/MVC/Controller/entry_point_registry.php

In this case, it is download.php at the root.

Changing it won’t be upgrade-safe, though… There are ways to add custom entrypoints to SuiteCRM, but what you’re asking about is to override a default entrypoint, which is a bit different.

Remember you might be better off doing things from the UI, not from the entrypoint. So it might be easier to override the view classes and have Javascript change bits of the screen. You can also make it point to a custom entrypoint instead.

1 Like

Thank you pgr,

that ultimately was what we did:
we created a customized detailviewdefs.php in custom/modules/<my_module>/metadata which was a copy of the original one, except for the fact that we introduced a customized version of the “default” panels.
A panel with a dynamically forged link was defined, and then we defined a particular entry point to handle the call to this link.

So far, it is working as intended.

Cool, I’m glad you got it working :slight_smile: