-1

There's probably an easy answer, but I just want to clarify.

In the documentation I see that we can create a custom view using the MODULE framework, but same can be done using the EXTENSION framework.

When do you pick one over the other? Is it just a matter of preference?

Update:

On page 727 of the guide (developer guide for sugar 6.5) it says "This is handy if you want to map a file as a view outside of the custom/modules//views/view..php"

The file is placed in custom/Extensions/modules/[module]/Ext/ActionFileMap

^ But we can also create a custom view by simply creating a file in custom/modules/[module]/views/view..php so the only point of using the example on 727 is when we want a custom view file to be outside of that folder? So this whole "extension framework" way of doing things is only for that?

Robert Sinclair
  • 4,550
  • 2
  • 44
  • 46
  • May I ask why this is getting downvoted? I read the official guide twice and the suitecrm book, there's no clear answer to this question in either one – Robert Sinclair Oct 06 '18 at 20:32
  • 1
    I feel this is more of a softwareengineeringstackexchange question given that it isn't about code itself, but methodologies – Krupip Oct 07 '18 at 00:06
  • 1
    @RobertSinclair Can please you link the documentation you're referring to, so that we get a better idea of what you're talking about? Thanks! – Jay Oct 07 '18 at 13:16
  • I assume with "developer guide for sugar 6.5" you are referring to https://support.sugarcrm.com/files/317538cc-6bff-11e7-916c-067914c4cb97.pdf – Jay Oct 08 '18 at 19:47

1 Answers1

2

Assuming with those frameworks you mean the custom folder and modules folder, I think there are basically the following scenarios:

  • You want to add a view to a stock module of the CRM
    Add your views and customizations in the custom folder (whenever possible), that way your additions are the least likely to get removed/overwritten/disrupted by future CRM updates. Also it will be easier for you to differ between which files are stock files and which ones are yours.
  • You want to add a view to a custom module (ModuleBuilder/hand-crafted)
    Here you can choose to put your custom views in the modules folder instead, as that module is under your own control anyway.
    However, you might prefer to place customer/instance-specific views in the custom folder (especially if future module reinstall/updates of the module are possible), while only placing views that are essential to your custom module across all installations in the module folder (and in the module's install package).

Update:

While I'm not actually familiar with ActionFileMap in particular, I can think of two reasons why you'd want to use it:

  • Linking a single view into more than one module
    This way you don't have to maintain more than one copy of the file.
  • The general reason why Sugar has its extension framework
    To allow developers to use arbitrary filenames (in this case even arbitrary file locations) instead of just having a single predefined file location.
    This way packages can be installed without overwriting each other's files.
    If they all used the same predefined file locations, they would undo the changes previously installed packages installed in the same file location.
    To avoid this from happening each package/customization can drop files with different, arbitrary names into predefinded extension folders, and Sugar Quick Repair & Rebuild will aggregate those files, regardless of their names, into custom/modules/<module>/Ext/*/*.ext.php (no /Extension/ in this path!).
    This allows the packages' changes to coexist more easily with each another.
Jay
  • 3,640
  • 12
  • 17
  • Thank you for the reply Jay! I just updated the question – Robert Sinclair Oct 08 '18 at 18:38
  • 1
    Thank you for the update, I also updated my answer. I hope it makes sense and is a bit helpful to you, even although I haven't used the ActionFileMap myself yet. I hardly use legacy modules these days (in Sugar 7+), but still something I learned about today and that might come in handy eventually, thanks! – Jay Oct 08 '18 at 20:11