SlideShare a Scribd company logo
Intro
• Power Hour
– Developer / Admin Resource
– Promote Successful Implementations
• Ticomix
– SugarCRM “Advanced” Partner
– 2014 Rising Star
– Consulting, Development & Support
– www.ticomixcrm.com
– @TicomixCRM / @TicomixInc
• Webinar Logistics
About Jeff Bickart
• Sugar Developer since version 4.0a
• Director of Engineering of a Voice-Enabled CRM
startup
• Chief Technology Officer, NEPO Systems − SugarCRM
GOLD Partner
• CRM Evangelist, Ticomix
• Contact Information
– @bickart
– www.linkedin.com/in/bickart
Sugar Development 101
Sugar as a Platform
• MVC (Module View Controller)
– Server Side
– Client Side
• ORM (Object Relationship Mapping)
– Beans
– Relationships
• API (Application Programming Interfaces)
– REST
– SOAP
• How and where to add customizations
– Extension Framework
– Logic Hooks
• Debugging tips and techniques
– IDE – Xdebug
– Logging
Development 101
• Directories of Interest
– custom
– cache
– data
– Modules
– include
– vendor
– sidecar
• Where do my changes belong?
– custom
– custom
– custom
– modules
Model, View and Controller (MVC)
SuiteCRM, Sugar 6, Sugar 7 #bwc
• Model
– SugarBeans
• View (Sugar 6 and Sugar 7 #bwc)
– Displaying information to the browser
• Detail View
• Edit View
• List View
– Two parts to a view
• metadata
– Example: custom/modules/Accounts/metadata/editviewdefs.php
• class loader
– Example: custom/modules/Accounts/views/view.edit.php
• Controller
– actions such as
• Display
• Save
• Etc.
Model, View and Controller (MVC)
Sugar 7 (client)
• Model
– Backbone.js
• gives structure to web applications by providing models with key-value binding and custom events,
collections with a rich API of enumerable functions, views with declarative event handling, and
connects it all to your existing API over a RESTful JSON interface.
• View
– Layouts
• Layouts are components which render the overall page. They are used to define the rows, columns,
and fluid layouts that the content is displayed to the user in.
– Views
• Views are components which render data from a context and may or may not include field
components. Example views include not only record and list views but also widgets
• Utilizes HandleBars and Controllers
– Fields
• Fields render widgets for individual values pulled from the models and handle formatting (or
stripping the formatting of) field values. Just like Layouts and Views, Fields also extend Backbone
Views
• Utilizes HandleBars and Controllers
Object Relationship Mapping (ORM)
• Beans
– CRUD (Create, Read, Update, Delete)
– Defined via Variable Definitions (i.e., vardefs) and
Templates
• Relationships
– Are the basis for linking information within the system
Sugar Object Templates
• Basic
– The building blocks needed to communicate with the DB.
– Fields
• id, name, date_entered, date_modified, created_by, modified_user_id, created_by, description, deleted
– Associated Relationships
• Company
– Additional information that pertains to a company; addresses, industry, revenue, etc.
• File
– Addition logic in order to be able to upload and maintain files in a module
• Issue
– This is the basis of cases
• Person
– Additional information as it pertains to a person; first_name, last_name, email addresses, etc.
• Sale
– The building blocks of an Opportunity; amount fields
Object Relational Model
• 99.9% of the time you do NOT need to write SQL!
• If you think that you need SQL you are doing something
WRONG!
• Sugar is Object Oriented
• SugarBean
– Performs all operations with the DB
• Create, Retrieve, Update, Delete
– All Modules extend the SugarBean
– Examples
• Leads -> Person -> Basic -> SugarBean
• Accounts -> Company -> Basic -> SugarBean
• Opportunity -> Sale -> Basic -> SugarBean
SugarBeans
data/SugarBean.php
• SugarBean is a component, that represents persistent
data maintained in a database
• Types
– basic, company, file, issue, person, sale
• Examples
– Accounts, Documents, Cases, Contacts, Opportunities
• Basic SugarBean
– All Beans extend basic which provides the fields:
– id, name, date_entered, date_modified, modified_user_id,
created_by, description, deleted
Vardefs (variable definitions)
• Sugar uses a file based approach to store all of the
information to describe each field as it relates to a module
and how that information should be stored in the DB
• Every module that communicates to the DB will need a
vardefs.php file
– <module>/vardefs.php
– At the end of the file, you must tell Sugar which template to base
your module upon
• if (!class_exists('VardefManager')) {
require_once 'include/SugarObjects/VardefManager.php';
}
VardefManager::createVardef('TCX_Passwords', 'TCX_Passwords',
array('basic', 'team_security', 'assignable'));
Vardefs
Continued
• Quick Repair and Rebuild
– Builds the aggregated version of the Vardefs into
cache/modules/<mymodule>/<MyModule>Vardefs.php
• Sugar uses this file for
– communicating to the DB
– display subpanels
– Join field
– Adding fields to the DB
– Aggregated Version comes From
• modules/<mymodule>/vardefs.php
• Template
– Include/SugarObjects/templates/
• fields_meta_data (fields added via Studio)
• custom/Extension/modules/<mymodule>/Ext/Vardefs
– sugarfield_field_name.php – generated when using Studio
SugarBean
Tips & Tricks
• Obtain a Bean by ID
• $account = BeanFactory::getBean(‘Accounts’, $id);
• $account = BeanFactory::getBean(‘Accounts’, $id,
array(‘disable_row_level_security’ => true));
• Obtain a set of Beans with filter
– Sugar 6
• $account = BeanFactory::newBean(‘Accounts’);
• $results = $accounts->get_list("", "accounts.assigned_user_id = '1'", 0);
– Sugar 7
• $accounts = BeanFactory::newBean('Accounts');
• $query = new SugarQuery();
• $query->from($accounts)->where()->equals('assigned_user_id','1');
• $results = $accounts->fetchFromQuery($query);
SugarBean
Relationships
• $account = BeanFactory::getBean($id);
• Get All Related Objects
– $account->load_relationship(‘contacts’);
– $contactList = $accounts->contacts->getBeans();
– $contactIDs = $accounts->conacts->get();
• Get subset of Related Objects
– Sugar 6
• $contactList = $accounts->get_linked_beans(‘contacts’, ‘Contact’, array(‘date_entered’), 0, 5);
– Sugar 7
• $current = $accounts->contacts->query(
array(
'where' => array(
'lhs_field' => ’type',
'operator' => '=',
'rhs_value' => ’Customer’
)
)
APIs
• Sugar 6
– SOAP
• <sugarcrm>/service/v4_1/soap.php
– REST
• <sugarcrm>/service/v4_1/soap.php
• Sugar 7
– <sugarcrm>/rest/v10
– Documentation
• <sugarcrm/rest/v10/help
Customizations
Sugar 6 Root Directory Structure
• data - This directory contains files related to SugarCRM's Model. You will find information about SugarBean as well as how relationship
are connected to the SugarBean
• examples - In this directory you will find a variety of examples on how to connect external sources into SugarCRM. There is a SOAP
example and some example configurations about
• include -- SugarCRM's framework and 3rd party libraries, except Zend and Xtemplate, used by SugarCRM
• install -- Logic to install SugarCRM. Once installed the files in this directory are unused
• jssource -- Original JavaScript files before they have been minified.
• log4php -- Deprecated logger replaced with include/SugarLogger: SugarCRM no longer uses log4php but the directory remains
• metadata -- This directly contains "join table" definitions. For example the definition of the accounts_contacts table
• ModuleInstall --Utilized by Upgrade Wizard, Module Loader and silentUpgrade to update the SugarCRM environment
• modules -- SugarCRM MVC for each section of the application. Examples include accounts and contacts
• portal -- Customer Portal: This code only works for Sugar Enterprise and Sugar Ultimate
• service -- WebServices are supported from here both REST and SOAP
• soap -- Deprecated version of the SOAP WebService, see the service directory for updated versions
• themes -- User Interface definitions that Sugar supports are located in this directory
• upload -- new location in 6.4. This is where uploaded files will be stored. Prior to 6.4 this directory was under cache
• xtemplate -- A library by PHP Xtemplate that is provided for backward compatibility. SugarCRM now uses the smarty Template Engine.
smarty can be found at include/smarty
• zend -- Portions of the Zend Framework that are used by SugarCRM
• cache -- This directory is used by SugarCRM application to store converted metadata that can be displayed by the SugarCRM application.
Items include screens, and data
• custom --All upgrade safe customization will go into this set of directories. Anything that is in here is safe from SugarCRM upgrade wizard
Sugar 7 Directory Structure
• Ext
– The Extension Framework can now be used from the core of Sugar
including within the core modules. So it is now possible to create
system wide extensions in custom/Ext
• ModuleInstall
• api
• cache
• clients
– Sugar UX code;
– Sugar now supports multiple clients
• base – Standard UX
• portal – Portal UX
– UX Elements such as SugarFields, Layouts, View, Dashlets
• custom
• data
• examples
• include
• install
• jssource
– JavaScript source code
• metadata
• mobile
– Access to mobile view of the product for example:
https://crm.ticomix.com/mobile
• modules
• portal2
– Enterprise portal
• service
• sidecar
– files used by the new UX, sidecar. Document can be found here:
https://jsduck.test.ticomix.net/
• soap
• styleguide
– Files used by the sytleguide available in Sugar
https://crm.ticomix.com/#Styleguide
• themes
• upgrade
• upload
• vendor
– All code not created by sugar has been moved to the vendor directory
which is consistent with composer
Logic Hooks
• Similar in nature to Workflows
• Not limited in functionality
• Examples:
– Communicate with 3rd Party Web Services
– Update data by assignment
– Send Notification(s)
• Location
– Sugar’s documentation doesn’t specify where Logic Hooks should reside.
– Module Logic Hooks
• custom/modules/<module>/LogicHooks - keeps them all together
• Prefer if you have a separate file for each Logic Hook; Easier to update a single file without effecting other Logic
Hooks
– custom/modules/<module>logic_hooks.php
<?php
/ $hook_version = 1;
$hook_array = Array();
$hook_array['after_save'] = Array();
$hook_array['after_save'][] = Array(10, 'Assign Authorize.Net to the
Contact',
'custom/modules/Leads/LogicHooks/UpdateAuthorizeNet.php','UpdateAuthorize
Net', 'addContactToAuthorizeNet');
Logic Hooks
Sugar 6
• Application Hooks
– after_entry_point
– after_ui_footer
– after_ui_frame
– server_round_trip
• Module Hooks
– after_delete
– after_relationship_add
– after_relationship_delete
– after_restore
– after_retrieve
– after_save
– before_delete
– before_relationship_add
– before_relationship_delete
– before_restore
– before_save
– handle_exception
– process_record
• User Hooks
– after_login
– after_logout
– before_logout
– before_login
– login_failed
• Job Queue Hooks
– job_failure
– job_failure_retry
• SNIP Hooks
– after_email_import
– before_email_import
Logic Hooks
Sugar 7
• Application Hooks
– after_entry_point
– after_ui_footer
– after_ui_frame
– server_round_trip
• Module Hooks
– after_delete
– after_relationship_add
– after_relationship_delete
– after_relationship_update
– after_restore
– after_retrieve
– after_save
– before_delete
– before_relationship_add
– before_relationship_delete
– before_restore
– before_save
– handle_exception
– process_record
• User Hooks
– after_load_user
– after_login
– after_logout
– before_logout
– login_failed
• Job Queue Hooks
– job_failure
– job_failure_retry
• SNIP Hooks
– after_email_import
– before_email_import
• API Hooks
– after_routing
– before_api_call
– before_filter
– before_respond
– before_routing.
• Web Logic Hooks
– Web Logic Hooks allow for administrators to post
record and event information to a specified URL
when certain sugar events take place
LogicHook Example
custom/modules/Accounts/logic_hooks.php
$hook_version = 1;
$hook_array = Array();
$hook_array['before_save'] = Array();
$hook_array['before_save'][] =
Array( 100,
'Reassign All Related Records',
'custom/modules/Accounts/ReassignHandler.php',
'ReassignHandler',
'reassignRecords');
Reassign All Related Records
before_save LogicHook
$user = new User();
$user->disable_row_level_security = true;
$user->retrieve($bean->assigned_user_id);
foreach ($bean->field_defs as $field => $info) {
if ($info['type'] == 'link') {
switch ($field) {
default:
$bean->load_relationship($field);
foreach ($bean->$field->getBeans(new $info['bean_name']) as $focus) {
if ($focus->id != "") {
$focus->assigned_user_id = $bean->assigned_user_id;
$focus->team_set_id = $user->team_set_id;
$focus->team_id = $user->default_team;
/* DO NOT SAVE THE EMAIL ADDRESSES */
$focus->in_workflow = true;
$focus->save(false);
}
}
}
}
}
Debuging
Logging
• $GLOBALS[‘log’]->
– fatal
– error
– warn
– info
– debug
• _ppl
Debuging
• xdebug
Future Webinars
Topics Subject to Change
• Future Topics
– Using the SugarJobQueue
– LogicHooks
– Deploying Packages
– Layouts
– Views
– Fields
– Building a Wizard

More Related Content

Similar to June 10th: The SugarCRM Platform

SharePoint 2013 - What's New
SharePoint 2013 - What's NewSharePoint 2013 - What's New
SharePoint 2013 - What's New
AdventosConsulting
 
SilverStripe From a Developer's Perspective
SilverStripe From a Developer's PerspectiveSilverStripe From a Developer's Perspective
SilverStripe From a Developer's Perspective
ajshort
 
SQL Server 2019 Master Data Service
SQL Server 2019 Master Data ServiceSQL Server 2019 Master Data Service
SQL Server 2019 Master Data Service
Kenichiro Nakamura
 
Super Fast Application development with Mura CMS
Super Fast Application development with Mura CMSSuper Fast Application development with Mura CMS
Super Fast Application development with Mura CMS
ColdFusionConference
 
CDMI For Swift
CDMI For SwiftCDMI For Swift
CDMI For Swift
Mark Carlson
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Lucidworks
 
Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
Harikrishnan C
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Chris Muir
 
Architect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh ArchitectureArchitect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh Architecture
Databricks
 
Drupal: Reusing functionality
Drupal: Reusing functionalityDrupal: Reusing functionality
Drupal: Reusing functionalityRaymond Muilwijk
 
Spring data presentation
Spring data presentationSpring data presentation
Spring data presentation
Oleksii Usyk
 
MongoDB Deployment Checklist
MongoDB Deployment ChecklistMongoDB Deployment Checklist
MongoDB Deployment Checklist
MongoDB
 
Cloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USA
Cloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USACloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USA
Cloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USA
Selvaratnam Uthaiyashankar
 
SplunkLive! Advanced Session
SplunkLive! Advanced SessionSplunkLive! Advanced Session
SplunkLive! Advanced SessionSplunk
 
Alfresco Records Management Tech Talk Live September 2015
Alfresco Records Management Tech Talk Live September 2015Alfresco Records Management Tech Talk Live September 2015
Alfresco Records Management Tech Talk Live September 2015
David Webster
 
CTDA MODS and Islandora XML Forms
CTDA MODS and Islandora XML FormsCTDA MODS and Islandora XML Forms
CTDA MODS and Islandora XML Forms
University of Connecticut Libraries
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructureharendra_pathak
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
Oscar Merida
 
Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501
Tjarda Peelen
 

Similar to June 10th: The SugarCRM Platform (20)

SharePoint 2013 - What's New
SharePoint 2013 - What's NewSharePoint 2013 - What's New
SharePoint 2013 - What's New
 
SilverStripe From a Developer's Perspective
SilverStripe From a Developer's PerspectiveSilverStripe From a Developer's Perspective
SilverStripe From a Developer's Perspective
 
SQL Server 2019 Master Data Service
SQL Server 2019 Master Data ServiceSQL Server 2019 Master Data Service
SQL Server 2019 Master Data Service
 
Super Fast Application development with Mura CMS
Super Fast Application development with Mura CMSSuper Fast Application development with Mura CMS
Super Fast Application development with Mura CMS
 
CDMI For Swift
CDMI For SwiftCDMI For Swift
CDMI For Swift
 
Real world rm in share point 2013
Real world rm in share point 2013Real world rm in share point 2013
Real world rm in share point 2013
 
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
Challenges of Simple Documents: When Basic isn't so Basic - Cassandra Targett...
 
Ember - introduction
Ember - introductionEmber - introduction
Ember - introduction
 
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure DecisionsOracle ADF Architecture TV - Design - MDS Infrastructure Decisions
Oracle ADF Architecture TV - Design - MDS Infrastructure Decisions
 
Architect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh ArchitectureArchitect’s Open-Source Guide for a Data Mesh Architecture
Architect’s Open-Source Guide for a Data Mesh Architecture
 
Drupal: Reusing functionality
Drupal: Reusing functionalityDrupal: Reusing functionality
Drupal: Reusing functionality
 
Spring data presentation
Spring data presentationSpring data presentation
Spring data presentation
 
MongoDB Deployment Checklist
MongoDB Deployment ChecklistMongoDB Deployment Checklist
MongoDB Deployment Checklist
 
Cloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USA
Cloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USACloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USA
Cloud to Cloud and Cloud to Enterprise Integration - WSO2Con 2014 USA
 
SplunkLive! Advanced Session
SplunkLive! Advanced SessionSplunkLive! Advanced Session
SplunkLive! Advanced Session
 
Alfresco Records Management Tech Talk Live September 2015
Alfresco Records Management Tech Talk Live September 2015Alfresco Records Management Tech Talk Live September 2015
Alfresco Records Management Tech Talk Live September 2015
 
CTDA MODS and Islandora XML Forms
CTDA MODS and Islandora XML FormsCTDA MODS and Islandora XML Forms
CTDA MODS and Islandora XML Forms
 
Architectures, Frameworks and Infrastructure
Architectures, Frameworks and InfrastructureArchitectures, Frameworks and Infrastructure
Architectures, Frameworks and Infrastructure
 
Staying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHPStaying Sane with Drupal NEPHP
Staying Sane with Drupal NEPHP
 
Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501Alfresco Business Reporting - Tech Talk Live 20130501
Alfresco Business Reporting - Tech Talk Live 20130501
 

More from ticomixcrm

August 12: Sugar’s Security Model – Teams and Roles
August 12: Sugar’s Security Model – Teams and Roles August 12: Sugar’s Security Model – Teams and Roles
August 12: Sugar’s Security Model – Teams and Roles
ticomixcrm
 
CRM360: ACT ON Presentation
CRM360: ACT ON PresentationCRM360: ACT ON Presentation
CRM360: ACT ON Presentation
ticomixcrm
 
July 8th: Layouts, Views and Building a Wizard
July 8th: Layouts, Views and Building a WizardJuly 8th: Layouts, Views and Building a Wizard
July 8th: Layouts, Views and Building a Wizard
ticomixcrm
 
Crm 360 d&b-final
Crm 360 d&b-finalCrm 360 d&b-final
Crm 360 d&b-final
ticomixcrm
 
April 8th: Module Builder & Studio
April 8th: Module Builder & StudioApril 8th: Module Builder & Studio
April 8th: Module Builder & Studio
ticomixcrm
 
CRM360 bristol-final
CRM360 bristol-finalCRM360 bristol-final
CRM360 bristol-final
ticomixcrm
 
CRM360 d&b-final
CRM360 d&b-finalCRM360 d&b-final
CRM360 d&b-final
ticomixcrm
 

More from ticomixcrm (7)

August 12: Sugar’s Security Model – Teams and Roles
August 12: Sugar’s Security Model – Teams and Roles August 12: Sugar’s Security Model – Teams and Roles
August 12: Sugar’s Security Model – Teams and Roles
 
CRM360: ACT ON Presentation
CRM360: ACT ON PresentationCRM360: ACT ON Presentation
CRM360: ACT ON Presentation
 
July 8th: Layouts, Views and Building a Wizard
July 8th: Layouts, Views and Building a WizardJuly 8th: Layouts, Views and Building a Wizard
July 8th: Layouts, Views and Building a Wizard
 
Crm 360 d&b-final
Crm 360 d&b-finalCrm 360 d&b-final
Crm 360 d&b-final
 
April 8th: Module Builder & Studio
April 8th: Module Builder & StudioApril 8th: Module Builder & Studio
April 8th: Module Builder & Studio
 
CRM360 bristol-final
CRM360 bristol-finalCRM360 bristol-final
CRM360 bristol-final
 
CRM360 d&b-final
CRM360 d&b-finalCRM360 d&b-final
CRM360 d&b-final
 

Recently uploaded

The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...
Adam Smith
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
tanyjahb
 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
HumanResourceDimensi1
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
Erika906060
 
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdfSearch Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Arihant Webtech Pvt. Ltd
 
Enterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdfEnterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdf
KaiNexus
 
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
BBPMedia1
 
Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...
dylandmeas
 
Skye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto AirportSkye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto Airport
marketingjdass
 
The-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic managementThe-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic management
Bojamma2
 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
usawebmarket
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
creerey
 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
balatucanapplelovely
 
The Parable of the Pipeline a book every new businessman or business student ...
The Parable of the Pipeline a book every new businessman or business student ...The Parable of the Pipeline a book every new businessman or business student ...
The Parable of the Pipeline a book every new businessman or business student ...
awaisafdar
 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
sarahvanessa51503
 
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptxCADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
fakeloginn69
 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
RajPriye
 
What is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdfWhat is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdf
seoforlegalpillers
 
amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05
marketing317746
 
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdfikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
agatadrynko
 

Recently uploaded (20)

The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...The Influence of Marketing Strategy and Market Competition on Business Perfor...
The Influence of Marketing Strategy and Market Competition on Business Perfor...
 
3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx3.0 Project 2_ Developing My Brand Identity Kit.pptx
3.0 Project 2_ Developing My Brand Identity Kit.pptx
 
What are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdfWhat are the main advantages of using HR recruiter services.pdf
What are the main advantages of using HR recruiter services.pdf
 
Attending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learnersAttending a job Interview for B1 and B2 Englsih learners
Attending a job Interview for B1 and B2 Englsih learners
 
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdfSearch Disrupted Google’s Leaked Documents Rock the SEO World.pdf
Search Disrupted Google’s Leaked Documents Rock the SEO World.pdf
 
Enterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdfEnterprise Excellence is Inclusive Excellence.pdf
Enterprise Excellence is Inclusive Excellence.pdf
 
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
RMD24 | Debunking the non-endemic revenue myth Marvin Vacquier Droop | First ...
 
Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...Discover the innovative and creative projects that highlight my journey throu...
Discover the innovative and creative projects that highlight my journey throu...
 
Skye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto AirportSkye Residences | Extended Stay Residences Near Toronto Airport
Skye Residences | Extended Stay Residences Near Toronto Airport
 
The-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic managementThe-McKinsey-7S-Framework. strategic management
The-McKinsey-7S-Framework. strategic management
 
Buy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star ReviewsBuy Verified PayPal Account | Buy Google 5 Star Reviews
Buy Verified PayPal Account | Buy Google 5 Star Reviews
 
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBdCree_Rey_BrandIdentityKit.PDF_PersonalBd
Cree_Rey_BrandIdentityKit.PDF_PersonalBd
 
The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...The effects of customers service quality and online reviews on customer loyal...
The effects of customers service quality and online reviews on customer loyal...
 
The Parable of the Pipeline a book every new businessman or business student ...
The Parable of the Pipeline a book every new businessman or business student ...The Parable of the Pipeline a book every new businessman or business student ...
The Parable of the Pipeline a book every new businessman or business student ...
 
Brand Analysis for an artist named Struan
Brand Analysis for an artist named StruanBrand Analysis for an artist named Struan
Brand Analysis for an artist named Struan
 
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptxCADAVER AS OUR FIRST TEACHER anatomt in your.pptx
CADAVER AS OUR FIRST TEACHER anatomt in your.pptx
 
Project File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdfProject File Report BBA 6th semester.pdf
Project File Report BBA 6th semester.pdf
 
What is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdfWhat is the TDS Return Filing Due Date for FY 2024-25.pdf
What is the TDS Return Filing Due Date for FY 2024-25.pdf
 
amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05amptalk_RecruitingDeck_english_2024.06.05
amptalk_RecruitingDeck_english_2024.06.05
 
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdfikea_woodgreen_petscharity_cat-alogue_digital.pdf
ikea_woodgreen_petscharity_cat-alogue_digital.pdf
 

June 10th: The SugarCRM Platform

  • 1.
  • 2. Intro • Power Hour – Developer / Admin Resource – Promote Successful Implementations • Ticomix – SugarCRM “Advanced” Partner – 2014 Rising Star – Consulting, Development & Support – www.ticomixcrm.com – @TicomixCRM / @TicomixInc • Webinar Logistics
  • 3. About Jeff Bickart • Sugar Developer since version 4.0a • Director of Engineering of a Voice-Enabled CRM startup • Chief Technology Officer, NEPO Systems − SugarCRM GOLD Partner • CRM Evangelist, Ticomix • Contact Information – @bickart – www.linkedin.com/in/bickart
  • 4. Sugar Development 101 Sugar as a Platform • MVC (Module View Controller) – Server Side – Client Side • ORM (Object Relationship Mapping) – Beans – Relationships • API (Application Programming Interfaces) – REST – SOAP • How and where to add customizations – Extension Framework – Logic Hooks • Debugging tips and techniques – IDE – Xdebug – Logging
  • 5. Development 101 • Directories of Interest – custom – cache – data – Modules – include – vendor – sidecar • Where do my changes belong? – custom – custom – custom – modules
  • 6. Model, View and Controller (MVC) SuiteCRM, Sugar 6, Sugar 7 #bwc • Model – SugarBeans • View (Sugar 6 and Sugar 7 #bwc) – Displaying information to the browser • Detail View • Edit View • List View – Two parts to a view • metadata – Example: custom/modules/Accounts/metadata/editviewdefs.php • class loader – Example: custom/modules/Accounts/views/view.edit.php • Controller – actions such as • Display • Save • Etc.
  • 7. Model, View and Controller (MVC) Sugar 7 (client) • Model – Backbone.js • gives structure to web applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing API over a RESTful JSON interface. • View – Layouts • Layouts are components which render the overall page. They are used to define the rows, columns, and fluid layouts that the content is displayed to the user in. – Views • Views are components which render data from a context and may or may not include field components. Example views include not only record and list views but also widgets • Utilizes HandleBars and Controllers – Fields • Fields render widgets for individual values pulled from the models and handle formatting (or stripping the formatting of) field values. Just like Layouts and Views, Fields also extend Backbone Views • Utilizes HandleBars and Controllers
  • 8. Object Relationship Mapping (ORM) • Beans – CRUD (Create, Read, Update, Delete) – Defined via Variable Definitions (i.e., vardefs) and Templates • Relationships – Are the basis for linking information within the system
  • 9. Sugar Object Templates • Basic – The building blocks needed to communicate with the DB. – Fields • id, name, date_entered, date_modified, created_by, modified_user_id, created_by, description, deleted – Associated Relationships • Company – Additional information that pertains to a company; addresses, industry, revenue, etc. • File – Addition logic in order to be able to upload and maintain files in a module • Issue – This is the basis of cases • Person – Additional information as it pertains to a person; first_name, last_name, email addresses, etc. • Sale – The building blocks of an Opportunity; amount fields
  • 10. Object Relational Model • 99.9% of the time you do NOT need to write SQL! • If you think that you need SQL you are doing something WRONG! • Sugar is Object Oriented • SugarBean – Performs all operations with the DB • Create, Retrieve, Update, Delete – All Modules extend the SugarBean – Examples • Leads -> Person -> Basic -> SugarBean • Accounts -> Company -> Basic -> SugarBean • Opportunity -> Sale -> Basic -> SugarBean
  • 11. SugarBeans data/SugarBean.php • SugarBean is a component, that represents persistent data maintained in a database • Types – basic, company, file, issue, person, sale • Examples – Accounts, Documents, Cases, Contacts, Opportunities • Basic SugarBean – All Beans extend basic which provides the fields: – id, name, date_entered, date_modified, modified_user_id, created_by, description, deleted
  • 12. Vardefs (variable definitions) • Sugar uses a file based approach to store all of the information to describe each field as it relates to a module and how that information should be stored in the DB • Every module that communicates to the DB will need a vardefs.php file – <module>/vardefs.php – At the end of the file, you must tell Sugar which template to base your module upon • if (!class_exists('VardefManager')) { require_once 'include/SugarObjects/VardefManager.php'; } VardefManager::createVardef('TCX_Passwords', 'TCX_Passwords', array('basic', 'team_security', 'assignable'));
  • 13. Vardefs Continued • Quick Repair and Rebuild – Builds the aggregated version of the Vardefs into cache/modules/<mymodule>/<MyModule>Vardefs.php • Sugar uses this file for – communicating to the DB – display subpanels – Join field – Adding fields to the DB – Aggregated Version comes From • modules/<mymodule>/vardefs.php • Template – Include/SugarObjects/templates/ • fields_meta_data (fields added via Studio) • custom/Extension/modules/<mymodule>/Ext/Vardefs – sugarfield_field_name.php – generated when using Studio
  • 14. SugarBean Tips & Tricks • Obtain a Bean by ID • $account = BeanFactory::getBean(‘Accounts’, $id); • $account = BeanFactory::getBean(‘Accounts’, $id, array(‘disable_row_level_security’ => true)); • Obtain a set of Beans with filter – Sugar 6 • $account = BeanFactory::newBean(‘Accounts’); • $results = $accounts->get_list("", "accounts.assigned_user_id = '1'", 0); – Sugar 7 • $accounts = BeanFactory::newBean('Accounts'); • $query = new SugarQuery(); • $query->from($accounts)->where()->equals('assigned_user_id','1'); • $results = $accounts->fetchFromQuery($query);
  • 15. SugarBean Relationships • $account = BeanFactory::getBean($id); • Get All Related Objects – $account->load_relationship(‘contacts’); – $contactList = $accounts->contacts->getBeans(); – $contactIDs = $accounts->conacts->get(); • Get subset of Related Objects – Sugar 6 • $contactList = $accounts->get_linked_beans(‘contacts’, ‘Contact’, array(‘date_entered’), 0, 5); – Sugar 7 • $current = $accounts->contacts->query( array( 'where' => array( 'lhs_field' => ’type', 'operator' => '=', 'rhs_value' => ’Customer’ ) )
  • 16. APIs • Sugar 6 – SOAP • <sugarcrm>/service/v4_1/soap.php – REST • <sugarcrm>/service/v4_1/soap.php • Sugar 7 – <sugarcrm>/rest/v10 – Documentation • <sugarcrm/rest/v10/help
  • 18. Sugar 6 Root Directory Structure • data - This directory contains files related to SugarCRM's Model. You will find information about SugarBean as well as how relationship are connected to the SugarBean • examples - In this directory you will find a variety of examples on how to connect external sources into SugarCRM. There is a SOAP example and some example configurations about • include -- SugarCRM's framework and 3rd party libraries, except Zend and Xtemplate, used by SugarCRM • install -- Logic to install SugarCRM. Once installed the files in this directory are unused • jssource -- Original JavaScript files before they have been minified. • log4php -- Deprecated logger replaced with include/SugarLogger: SugarCRM no longer uses log4php but the directory remains • metadata -- This directly contains "join table" definitions. For example the definition of the accounts_contacts table • ModuleInstall --Utilized by Upgrade Wizard, Module Loader and silentUpgrade to update the SugarCRM environment • modules -- SugarCRM MVC for each section of the application. Examples include accounts and contacts • portal -- Customer Portal: This code only works for Sugar Enterprise and Sugar Ultimate • service -- WebServices are supported from here both REST and SOAP • soap -- Deprecated version of the SOAP WebService, see the service directory for updated versions • themes -- User Interface definitions that Sugar supports are located in this directory • upload -- new location in 6.4. This is where uploaded files will be stored. Prior to 6.4 this directory was under cache • xtemplate -- A library by PHP Xtemplate that is provided for backward compatibility. SugarCRM now uses the smarty Template Engine. smarty can be found at include/smarty • zend -- Portions of the Zend Framework that are used by SugarCRM • cache -- This directory is used by SugarCRM application to store converted metadata that can be displayed by the SugarCRM application. Items include screens, and data • custom --All upgrade safe customization will go into this set of directories. Anything that is in here is safe from SugarCRM upgrade wizard
  • 19. Sugar 7 Directory Structure • Ext – The Extension Framework can now be used from the core of Sugar including within the core modules. So it is now possible to create system wide extensions in custom/Ext • ModuleInstall • api • cache • clients – Sugar UX code; – Sugar now supports multiple clients • base – Standard UX • portal – Portal UX – UX Elements such as SugarFields, Layouts, View, Dashlets • custom • data • examples • include • install • jssource – JavaScript source code • metadata • mobile – Access to mobile view of the product for example: https://crm.ticomix.com/mobile • modules • portal2 – Enterprise portal • service • sidecar – files used by the new UX, sidecar. Document can be found here: https://jsduck.test.ticomix.net/ • soap • styleguide – Files used by the sytleguide available in Sugar https://crm.ticomix.com/#Styleguide • themes • upgrade • upload • vendor – All code not created by sugar has been moved to the vendor directory which is consistent with composer
  • 20. Logic Hooks • Similar in nature to Workflows • Not limited in functionality • Examples: – Communicate with 3rd Party Web Services – Update data by assignment – Send Notification(s) • Location – Sugar’s documentation doesn’t specify where Logic Hooks should reside. – Module Logic Hooks • custom/modules/<module>/LogicHooks - keeps them all together • Prefer if you have a separate file for each Logic Hook; Easier to update a single file without effecting other Logic Hooks – custom/modules/<module>logic_hooks.php <?php / $hook_version = 1; $hook_array = Array(); $hook_array['after_save'] = Array(); $hook_array['after_save'][] = Array(10, 'Assign Authorize.Net to the Contact', 'custom/modules/Leads/LogicHooks/UpdateAuthorizeNet.php','UpdateAuthorize Net', 'addContactToAuthorizeNet');
  • 21. Logic Hooks Sugar 6 • Application Hooks – after_entry_point – after_ui_footer – after_ui_frame – server_round_trip • Module Hooks – after_delete – after_relationship_add – after_relationship_delete – after_restore – after_retrieve – after_save – before_delete – before_relationship_add – before_relationship_delete – before_restore – before_save – handle_exception – process_record • User Hooks – after_login – after_logout – before_logout – before_login – login_failed • Job Queue Hooks – job_failure – job_failure_retry • SNIP Hooks – after_email_import – before_email_import
  • 22. Logic Hooks Sugar 7 • Application Hooks – after_entry_point – after_ui_footer – after_ui_frame – server_round_trip • Module Hooks – after_delete – after_relationship_add – after_relationship_delete – after_relationship_update – after_restore – after_retrieve – after_save – before_delete – before_relationship_add – before_relationship_delete – before_restore – before_save – handle_exception – process_record • User Hooks – after_load_user – after_login – after_logout – before_logout – login_failed • Job Queue Hooks – job_failure – job_failure_retry • SNIP Hooks – after_email_import – before_email_import • API Hooks – after_routing – before_api_call – before_filter – before_respond – before_routing. • Web Logic Hooks – Web Logic Hooks allow for administrators to post record and event information to a specified URL when certain sugar events take place
  • 23. LogicHook Example custom/modules/Accounts/logic_hooks.php $hook_version = 1; $hook_array = Array(); $hook_array['before_save'] = Array(); $hook_array['before_save'][] = Array( 100, 'Reassign All Related Records', 'custom/modules/Accounts/ReassignHandler.php', 'ReassignHandler', 'reassignRecords');
  • 24. Reassign All Related Records before_save LogicHook $user = new User(); $user->disable_row_level_security = true; $user->retrieve($bean->assigned_user_id); foreach ($bean->field_defs as $field => $info) { if ($info['type'] == 'link') { switch ($field) { default: $bean->load_relationship($field); foreach ($bean->$field->getBeans(new $info['bean_name']) as $focus) { if ($focus->id != "") { $focus->assigned_user_id = $bean->assigned_user_id; $focus->team_set_id = $user->team_set_id; $focus->team_id = $user->default_team; /* DO NOT SAVE THE EMAIL ADDRESSES */ $focus->in_workflow = true; $focus->save(false); } } } } }
  • 26. Logging • $GLOBALS[‘log’]-> – fatal – error – warn – info – debug • _ppl
  • 28. Future Webinars Topics Subject to Change • Future Topics – Using the SugarJobQueue – LogicHooks – Deploying Packages – Layouts – Views – Fields – Building a Wizard

Editor's Notes

  1. Why – we are experts in the field of SugarCRM and have been doing this for a long time and we recognize that its sometimes challenging to the the support you need, specifically for developers. Given our investment in the Sugar community we think its important to make sure that ALL users of sugar are finding success, deploying solutions that provide true value for your business… That said, we know we have a user group here that have varying technical backgrounds, some of you are admins and some are developers. When initially conceived, this Power Hour was designed with the Developer in mind, but due to the response we’ve received from this, we are considering creating two separate tracks, one for developers and one for admins. Regardless of your position, I would encourage you to stay connected today to get a sense of how these webinars will be conducted moving forward… So, what I’d like to do real quick, is have everyone simply answer this one poll question so we can get a better sense of our demographic. Ticomix was founded in 2000 and has locations and people across the country. We are currently an “Advanced” SugarCRM partner, making us one of the top 20 partners in the North America and we have a relationship with Sugar dating back to 2009. Last year we received the sole “Rising Star” award from Sugar, which demonstrates their confidence in Ticomix to continue to develop as one of the top Sugar providers in the world… We provide a full suite of services ranging from Sugar consulting through to on-going support. So, I know that was brief, but we want to turn this over to Jeff as quickly as possible to try and give you as much value from this hour as possible.. So just a couple of logistics.