SuiteCRM: Why Module Builder and Studio Are Not the Same (and why this complicates APIs development)

If you’ve spent any serious time with SuiteCRM, you’ve probably hit this confusion sooner or later:
“Why does this field look different in the API than it does in the UI?”
Nine times out of ten, the answer lives in the split brain of Module Builder vs Studio. Let’s break it down.


Module Builder vs Studio: Same Goal, Very Different DNA

At a high level, both tools exist to customize the CRM. In practice, they serve very different roles.

Module Builder

  • Used to create new modules (custom entities).
  • Generates base PHP code, vardefs, relationships, language files.
  • Intended to be deployable and upgrade-safe.
  • You define fields before the module becomes “real” in the system.

Think of Module Builder as schema design time.

Studio

  • Used to modify existing modules (core or custom).
  • Adds or edits fields, layouts, labels, and relationships.
  • Works directly on metadata overlays.
  • Faster, more visual, but more implicit.

Think of Studio as runtime mutation.


Where Naming Conventions Go Off the Rails

This is where API developers start feeling confused.

Field Names in Module Builder

When you define a field in Module Builder:

  • You choose a logical name (e.g. contract_value)
  • SuiteCRM generates a database-safe name
  • Everything is mostly predictable

Example:

contract_value

Clean, expected, consistent.


Field Names in Studio

Studio looks simpler, but it adds hidden complexity:

  • Custom fields end with _c
  • Some field types generate secondary fields
  • Relationships create implicit link names
  • Labels and field names are often conflated

Example:

  • You create a “Customer” relate field
  • You get:
    • customer_id_c
    • customer_name
    • customer_name_c (sometimes)
    • a hidden link field

Which one shows up in the API?
Depends on context. 😐


How This Breaks API Development

From an API perspective (REST v4, v4_1, or custom endpoints), this split causes real pain:

1. Unstable Field Contracts

An API consumer expects:

{  "contract_value": 5000 }

But SuiteCRM responds with:

{  "contract_value_c": "5000",  "contract_value_c_display": "€5,000"}

Or worse, the field doesn’t appear at all unless explicitly added to vardefs.


2. Different Names in UI vs API

  • UI label: Customer
  • Studio field name: customer_name
  • API writable field: customer_id_c
  • API readable field: customer_name

So:

  • You read one field
  • You write another
  • Neither matches what the user sees

That’s not just annoying, it’s error-prone.


3. Relationship Fields Are Especially Messy

Relate and link fields:

  • Are not always returned by default
  • May require link_name instead of field_name
  • Often behave differently between list views and record views

This makes generic API integrations (mobile apps, middleware, ETL pipelines) much harder to build and maintain.


The Core Problem: Two Customization Layers, One API

SuiteCRM exposes one API, but:

  • Module Builder defines structural truth
  • Studio defines behavioral overrides

The API doesn’t clearly distinguish between the two.

So developers are forced to:

  • Inspect vardefs manually
  • Diff metadata files
  • Test endpoints experimentally
  • Hard-code field mappings (😬)

Practical Takeaways

If you’re building serious integrations on top of SuiteCRM:

  1. Prefer Module Builder for anything API-critical
    Especially identifiers, numeric values, and foreign keys.
  2. Document your real API field names
    Not labels. Not UI names. Actual vardef keys.
  3. Treat Studio as a presentation layer
    Great for layouts. Dangerous for contracts.
  4. Expect drift over time
    A Studio change can silently break an API consumer months later.

Final Thought

SuiteCRM is powerful, but its flexibility comes at the cost of conceptual consistency.
Module Builder and Studio solve different problems, yet they share the same data surface. Until those layers are more cleanly separated, API developers will continue debugging metadata, instead of business logic.

Why SuiteCRM and Git Are a Difficult Combination (and How to Make It Work)

This is not a myth or a misunderstanding. SuiteCRM and Git are a difficult and often counter-productive combination if SuiteCRM is treated like a typical application repository. This is not a Git problem. It’s an architectural mismatch between how SuiteCRM works and how Git expects software to behave.


1. Auto-generated files everywhere

SuiteCRM:

  • regenerates files automatically
  • rebuilds metadata
  • generates PHP code from Admin UI actions

Git strongly assumes that files change because a developer intentionally changed them.

Result: git status is constantly full of changes that no one explicitly wrote.


2. The custom/ directory is not “clean source code”

In theory, custom/ is the safe place. In practice, it contains:

  • runtime-generated metadata
  • files recreated by Repair & Rebuild
  • Admin-UI-driven configuration output

So custom/ is not just source code. It is source code + application state mixed together. This breaks a core Git assumption.


3. Environment-specific noise

Many files are environment-dependent:

  • config.php, config_override.php
  • cached language files
  • vardefs and relationship metadata
  • system-generated PHP

Git cannot distinguish:

  • intentional changes
  • deployment artifacts
  • runtime side effects

This leads to meaningless diffs and risky commits.


4. SuiteCRM is not a typical framework

SuiteCRM is simultaneously:

  • a framework
  • a CMS
  • a runtime code generator

Key problem:

  • there is no clean separation between source → build → runtime
  • the application rewrites itself
  • Admin users effectively act as code generators

Git assumes deterministic builds.
SuiteCRM is not deterministic.


5. Team workflows break down quickly

In a team:

  • two people change Admin settings
  • different PHP files are regenerated
  • Git sees conflicts in auto-generated files

The conflicts are often:

  • hard to understand
  • not logically mergeable
  • unrelated to real business logic

The Core Conceptual Problem

SuiteCRM was not designed with “version control first” in mind.

It was designed for:

  • on-server configuration
  • Admin-driven customization
  • long-running mutable installations

Git was designed for:

  • immutable source code
  • reproducible builds
  • CI/CD pipelines

These two philosophies clash.


When SuiteCRM and Git Work Well

They work very well when SuiteCRM is treated as a platform, not as an app.

What should be in Git

  • logic hooks (custom/modules/**/logic_hooks.php)
  • custom action classes
  • integrations (APIs, webhooks, middleware)
  • only developer-written code
  • upgrade-safe extensions

What should not be in Git

  • cache directories
  • auto-generated vardefs
  • relationship metadata
  • Admin-generated configuration files
  • environment-specific config and secrets

The Correct Mindset

With SuiteCRM:

You do not version the installation.
You version the behavior you add to it.

In other words:

“This is the business logic we inject into the system”
not
“This is the full internal state of the CRM”


Conclusion

SuiteCRM + Git is a difficult combination. This is not a mistake, but a design mismatch. Git works perfectly when limited to custom business logic. Trying to version the entire SuiteCRM installation leads to chaos.

Πώς μπορώ να προσθέσω custom κώδικα σε ένα πεδίο μιας οντότητας (module);

Για να προσθέσουμε κώδικα σε ένα πεδίο, χρησιμοποιούμε αρχικά τη λογική του SuiteCRM που μας επιτρέπει να αλλάξουμε βασικά αρχεία ρυθμίσεων χωρίς να έχουμε το φόβο ότι θα διαγραφούν σε επόμενο update.

Με απλά λόγια: Αντιγράφουμε το αρχείο του module από τον κύριο κατάλογο (πχ public/legacy/modules/<όνομα του module που μας ενδιαφέρει>/metadata/detailviewdefs.php) στον ίδιο κατάλογο που βρίσκεται μέσα στο custom (στο παράδειγμά μας δηλαδή: public/legacy/custom/modules/<όνομα του module που μας ενδιαφέρει>/metadata/detailviewdefs.php).

Οπότε, μπορούμε πλέον να “πειράξουμε” τις ρυθμίσεις των πεδίων, όπως φαίνονται στο detailView, χωρίς να φοβόμαστε ότι το repair θα μας τις διαγράψει. Πάμε παρακάτω:

Όταν το σύστημα διαβάζει το συγκεκριμένο αρχείο, έχει συνήθως φορτωμένο το σχετικό object, το οποίο θα παρουσιάσει στη σχετική σελίδα. Μπορούμε λοιπόν να το διαβάσουμε και να πάρουμε από εκεί τις πληροφορίες που μας ενδιαφέρουν για να τις παρουσιάσουμε στη σελίδα μας.

Πχ αν θέλουμε να δείξουμε στο detailView (τα ίδια ισχύουν για το editView και για το listView) μια εικόνα που έχουμε φορτωμένη ως url σε άλλο πεδίο, μπορούμε να βάλουμε στην κορυφή του αρχείου detailviewdefs.php τον παρακάτω κώδικα, που φορτώνει το html για την εμφάνιση της φωτογραφίας και το αποθηκεύει στη μεταβλητή $image:

<?php
$module_name = ‘Accounts’;
$image = “<a href='” . $focus->media_url . “‘ target=’_blank’><img src='” . $focus->media_url . “‘ width=’100′ height=’100’></a>”;

Στη συνέχεια, βρίσκουμε το πεδίο που θέλουμε να δείξουμε τη φωτογραφία (και έχουμε πχ ορίσει πιο πριν στο studiο), πχ το “account_image” στην περίπτωσή μας, και προσθέτουμε custom code ως εξής:

array (
‘name’ => ‘account_image’,
‘studio’ => ‘visible’,
‘label’ => ‘LBL_ACCOUNT_IMAGE’,
‘customCode’ => $image,
),

Με αυτό τον τρόπο, έχουμε προσθέσει ειδικό κώδικα στο συγκεκριμένο πεδίο. Μπορούμε επίσης να καλέσουμε ajax δεδομένα, να τραβήξουμε στοιχεία από κάποιο endpoint κλπ.

Πώς αλλάζω τις επιλογές των μενού στο πλάι δεξιά; (SuiteCRM Έκδοση 7.11.15)

Οι επιλογές αλλάζουν από τον κώδικα, στο αρχείο globalControlLinks.php

Για να αλλάξεις πχ το 4ο λινκ, πήγαινε στο αρχείο include/globalControlLinks.php και άλλαξε τον παρακάτω κώδικα:

$global_control_links['training'] = array(
'linkinfo' => array($app_strings['LBL_TRAINING'] => 'https://community.suitecrm.com', 'target' => '_blank'),
'submenu' => ''
 );

βάζοντας στο 'linkinfo' το δικό σου λινκ, πχ:

$global_control_links['training'] = array(
'linkinfo' => array( "SuiteCRM.gr" => 'https://suitecrm.gr', 'target' => '_blank'),
'submenu' => '' );
Posted in Χωρίς κατηγορία

Δοκιμάστε το SuiteCRM ζωντανά! (Live Demo)

Εξερευνήστε το SuiteCRM και την ελληνική του έκδοση ζωντανά και διαπιστώστε τις τεράστιες δυνατότητές του! Επιλέξτε την παρακάτω εικόνα ή ακολουθήστε το σύνδεσμο https://crm.suitecrm.gr

Για λόγους ασφάλειας δεν παρέχουμε προς στιγμήν πρόσβαση στο διαχειριστικό τμήμα της εφαρμογής, σύντομα θα το παρέχουμε.

Επιλέξτε την εικόνα για να μεταφερθείτε στην εγκατάσταση παρουσίασης του SuiteCRM

Συνδεθείτε με username και password τη λέξη “guest”

Συνδεθείτε με τη λέξη “guest” ως username και password.

Εύκολη δημιουργία συσχετισμών των δεδομένων

Το ευέλικτο μοντέλο δεδομένων του SuiteCRM επιτρέπει να δημιουργείτε έναν ενιαίο χώρο αποθήκευσης, προσαρμοσμένο για όλα τα δεδομένα των πελατών σας. Σας επιτρέπει επίσης να χρησιμοποιείτε τις πληροφορίες που έχετε συλλέξει για τη βελτίωση της αποδοτικότητας, την κατανόηση των αναγκών των πελατών σας και την αυτοματοποίηση των βασικών ενεργειών σας. Οι ισχυρές αναφορές και οι πίνακες ελέγχου σας δίνουν μια γρήγορη προβολή των δεδομένων για την υποστήριξη της επιχείρησής σας.