EntryPoints

Entry Points are custom PHP scripts integrated into the SuiteCRM MVC controller. They provide a lightweight way to handle external requests—such as webhooks, file streams, or custom data exports—without the overhead of the REST API.

1. Accessing EntryPoints

SuiteCRM supports two URL patterns for invoking entry points. The "Clean URL" pattern is the modern standard and is handled natively by the system’s rewrite rules.

{{suitecrm.url}}/ep/MyAction

The Legacy Path

{{suitecrm.url}}/index.php?entryPoint=MyAction

2. The Upgrade-Safe Extension Approach

To ensure your entry points are upgrade-safe, they must be registered via the Extension Framework as defined in ModuleInstall/extensions.php.

Step 1: Create the Registry Extension

Create a new file at custom/Extension/application/Ext/EntryPointRegistry/<name>.php.

<?php
// custom/Extension/application/Ext/EntryPointRegistry/MyAction.php

$entry_point_registry['MyAction'] = array(
    'file' => 'custom/modules/MyModule/MyActionLogic.php',
    'auth' => true
);

Step 2: Create the Logic File

Create the logic file at the path defined above.

<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

global $db, $current_user;

// Your logic here
echo "Entry Point Executed successfully.";

Step 3: Rebuild the Registry

Run Quick Repair and Rebuild. SuiteCRM scans your extension and compiles it into the global registry located at: custom/application/Ext/EntryPointRegistry/entry_point_registry.ext.php

3. Configuration Options

Key Description

file

The path to the PHP file containing your logic (relative to the SuiteCRM root).

auth

Boolean. If true, a valid user session is required. If false, the script is publicly accessible.

4. How the Controller Processes Entry Points

The SugarController manages the execution flow via the preProcess() method:

  1. Detection: It identifies the entryPoint request (either from the URL parameter or the rewritten /ep/ path).

  2. Registry Load: It loads the core registry and merges it with the compiled extensions.

  3. Environment Boot: Because the request flows through the main controller, the full SuiteCRM environment (Database, BeanFactory, and Global Variables) is fully initialised and ready for use.

5. Best Practices

  • Clean Exits: Always use sugar_cleanup() or exit; at the end of your script to prevent the MVC from rendering standard UI components.

  • Output Buffering: Use ob_clean() if your entry point returns specific file headers to ensure no system-generated whitespace corrupts the output.

  • Respect ACLs: Use BeanFactory to fetch records, ensuring that your script respects the security groups and permissions of the $current_user.

Content is available under GNU Free Documentation License 1.3 or later unless otherwise noted.