Vous êtes sur la page 1sur 94

2013 SugarCRM Inc. All rights reserved.

CONFIDENTIAL
Benets of the enhanced
customization capabilities of Sugar
Sugar 7 Developer Training
Filipe Guerra (aka @alias_mac)
fguerra@sugarcrm.com
Joo Morais (aka @jcsmorais)
jmorais@sugarcrm.com
2013 SugarCRM Inc. All rights reserved.
Introduction
2
2013 SugarCRM Inc. All rights reserved.
Objectives
At the end of the session you will be able to:
3
2013 SugarCRM Inc. All rights reserved.
Objectives
At the end of the session you will be able to:
! Know about special features of Sugar
New platforms
New views
FTS on REST API
Filter API and Relate API
Dashlets
3
2013 SugarCRM Inc. All rights reserved.
Objectives
At the end of the session you will be able to:
! Know about special features of Sugar
New platforms
New views
FTS on REST API
Filter API and Relate API
Dashlets
! Tweak Sugar faster to achieve customers needs
3
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
4
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Why?
4
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Why?
Because you might want di!erent
metadata to integrate with other platforms
4
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Why?
Because you might want di!erent
metadata to integrate with other platforms
E.g.: website, ERP system
4
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Why?
Because you might want di!erent
metadata to integrate with other platforms
E.g.: website, ERP system
! How can you create another client?
4
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Why?
Because you might want di!erent
metadata to integrate with other platforms
E.g.: website, ERP system
! How can you create another client?
create !"#$%&'()! folder in your modules
or on $*+),"! folder
4
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
5
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Request myclient metadata:
5
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Request myclient metadata:
Public metadata:
https://<sugar-url>/rest/v10/metadata/
public?platform=myclient
5
2013 SugarCRM Inc. All rights reserved.
Ability to create other clients
! Request myclient metadata:
Public metadata:
https://<sugar-url>/rest/v10/metadata/
public?platform=myclient
Private metadata:
https://<sugar-url>/rest/v10/metadata?
platform=myclient
5
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
6
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
! Public:
No authentication needed
Provides public information for:
! basic conguration values
! i18n labels location to download
! logo location to download or use as image
source
6
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
7
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
! metadata:
public layouts
public views
public elds
public modules
! components location (jssource) minied
controllers:
public layouts
public views
public elds
public modules
7
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
8
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
! Private:
Authentication needed
Provides private information of:
! basic conguration values (normally = public)
! i18n labels location to download (normally =
public)
! logo location to download or use as image
source (normally = public)
8
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
! metadata:
private layouts
private views
private elds
private modules
! components location (jssource) minied
controllers:
private layouts
private views
private elds
private modules
9
2013 SugarCRM Inc. All rights reserved.
What is the di!erence?
! currencies available on the system
! module tab mapping (for mega menu)
! hidden subpanels
! relationships
! server information
10
2013 SugarCRM Inc. All rights reserved.
New views
11
2013 SugarCRM Inc. All rights reserved.
New views
! List view (Records)
11
2013 SugarCRM Inc. All rights reserved.
New views
! List view (Records)
! Detail/Edit view (Record)
11
2013 SugarCRM Inc. All rights reserved.
New views
! List view (Records)
! Detail/Edit view (Record)
! Create view (using Record view metadata)
11
2013 SugarCRM Inc. All rights reserved.
New views
! List view (Records)
! Detail/Edit view (Record)
! Create view (using Record view metadata)
! Custom views (e.g.: about,
administration, notications)
11
2013 SugarCRM Inc. All rights reserved.
New views
! List view (Records)
! Detail/Edit view (Record)
! Create view (using Record view metadata)
! Custom views (e.g.: about,
administration, notications)
! Url to use di!erent layout (using custom
routing)
11
2013 SugarCRM Inc. All rights reserved.
New views
! List view (Records)
! Detail/Edit view (Record)
! Create view (using Record view metadata)
! Custom views (e.g.: about,
administration, notications)
! Url to use di!erent layout (using custom
routing)
! Custom routing not supported on 7.0
11
2013 SugarCRM Inc. All rights reserved.
New views
!
-./,0*%'1 3 %4#,*)!5'$,50+!
!
-./,0*%'1!.&01 3 %4#,*)!5'$,50!
!
-./,0*%'1!$5'4)' 3 %4#,*)!$5'4)'!
!
-./,0*%'1!%4#,*)!.%4#,*)6(4"'1 3
%4#,*)!%4#,*)6(4"'
!
-./,0*%'1!$,(7&8 3 %4#,*)!$,(7&8!
12
2013 SugarCRM Inc. All rights reserved.
Full Text Search on REST API
! FTS requires ElasticSearch to be
installed on 7.0
!
9'45$: 7,5 ';'5#):&(8 ):4)
$,()4&(+ +,"'):&(8

<=> !+'45$:?@3.(''0%'1
!
A5 ,(%# ,( +,"' ",0*%'+

<=> !+'45$:?
@3.(''0%'1B",0*%'C%&+)3.",0*%'C%&+)1
13
2013 SugarCRM Inc. All rights reserved.
FTS on REST API
GET /search?q=units
{
"next_o!set": 20,
"records": [{
"id": "f8ac0bbd-aa3f-fec3-7fa5-5246447f23a4",
"name": "Send units example",
//...
"_module": "Tasks",
"_search": {
"score": 1
}
}, {
"id": "fed00b88-3e85-6b08-dd19-5246454519e7",
"name": "Q.R.&E. Corp - 268 Units",
//...
"_module": "Opportunities",
14
2013 SugarCRM Inc. All rights reserved.
Filter API
! Do searches like a SQL pro!

<=> !.",0*%'1?7&%)'5DEF
D7&'%0CGF3;4%*'CGB7&%)'5DGF
D%&(HC(4"'I7&'%0CJF3;4%*'CJ
! Or more readable:

!.",0*%'1?7&%)'53D
KL7&'%0CGMN L;4%*'CGMOP
KL%&(HC(4"'I7&'%0CJMN L;4%*'CJMO
F
15
2013 SugarCRM Inc. All rights reserved.
Filter API
GET /Accounts?lter[0][billing_address_state]=CA&lter[1][cases.status]=New
{
"next_o!set": -1,
"records": [{
"id": "f01e2bde-4284-e3ec-2379-524644b976fd",
"name": "T-Squared Techs",
//...
"_module": "Accounts"
}, {
"id": "eeea02c2-6171-f506-035b-5246440e0fdc",
"name": "Calm Sailing Inc",
//...
"_module": "Accounts"
16
2013 SugarCRM Inc. All rights reserved.
Relate API
17
2013 SugarCRM Inc. All rights reserved.
Relate API
! Get related records easily
17
2013 SugarCRM Inc. All rights reserved.
Relate API
! Get related records easily

<=> !.",0*%'1!.&01!%&(H!.%&(HC(4"'1
17
2013 SugarCRM Inc. All rights reserved.
Relate API
! Get related records easily

<=> !.",0*%'1!.&01!%&(H!.%&(HC(4"'1
! And you can lter them also
17
2013 SugarCRM Inc. All rights reserved.
Relate API
! Get related records easily

<=> !.",0*%'1!.&01!%&(H!.%&(HC(4"'1
! And you can lter them also

<=> !.",0*%'1!.&01!%&(H!.%&(HC(4"'1?
7&%)'53
17
2013 SugarCRM Inc. All rights reserved.
Relate API
! Get related records easily

<=> !.",0*%'1!.&01!%&(H!.%&(HC(4"'1
! And you can lter them also

<=> !.",0*%'1!.&01!%&(H!.%&(HC(4"'1?
7&%)'53
! Same rules of lter api (easy)
17
2013 SugarCRM Inc. All rights reserved.
Relate API
<=> !Q$$,*()+!7EG'JR0'6SJTS6'U'$6JUVW6XJSYSSRWVY70!%&(H!$4+'+
K
Z('[)C,77+')ZNJEP
Z5'$,50+ZNDK
Z&0ZNZ7U$GYJTT60YXE6JW0Y6TY'76XJSYSSTW07WEZP
Z(4"'ZNZ\''0 ), ]*5$:4+' 400&)&,(4% %&$'(+'+ZP
!!III
<=> !Q$$,*()+!7EG'JR0'6SJTS6'U'$6JUVW6XJSYSSRWVY70!%&(H!$4+'+?7&%)'5DEFD+)4)*+F3\'^
K
Z('[)C,77+')ZN6GP
Z5'$,50+ZNDK
Z&0ZNZUEJ4EJYR6R'SV6UWG'6V$WX6XJSYSSGXVYXWZP
Z(4"'ZNZ_45(&(8 "'++48' ^:'( *+&(8 ):' ^5,(8 R5,^+'5ZP
!!III
Z$4+'C(*"R'5ZNTYP
Z+)4)*+ZNZ\'^ZP
18
2013 SugarCRM Inc. All rights reserved.
Yes, you can still do retrieves...
! Get any record based on the module and id:

<=> !.",0*%'1!.&01
<=> !Q$$,*()+!7EG'JR0'6SJTS6'U'$6JUVW6XJSYSSRWVY70
K
Z&0ZN Z7EG'JR0'6SJTS6'U'$6JUVW6XJSYSSRWVY70ZP
Z(4"'ZN Z>69@*45'0 >'$:+ZP
!!III
19
2013 SugarCRM Inc. All rights reserved.
Slim payload
! On all of them you can slim the amount of elds
retrieved
! Pass 7&'%0+3(4"' to just get the name eld
! You will always get some elds (even if you
dont request them)
id
date_modied
_acl
following
_module
20
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
21
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Provided documentation on view
controllers (e.g.: +*845$5"!$%&'()+!
R4+'!;&'^+!)4RR'0604+:%')!)4RR'06
04+:%')I`+)
21
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Provided documentation on view
controllers (e.g.: +*845$5"!$%&'()+!
R4+'!;&'^+!)4RR'0604+:%')!)4RR'06
04+:%')I`+)
! Able to create views/layouts with
metadata only
21
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Provided documentation on view
controllers (e.g.: +*845$5"!$%&'()+!
R4+'!;&'^+!)4RR'0604+:%')!)4RR'06
04+:%')I`+)
! Able to create views/layouts with
metadata only
! Able to do quicker tweaks with
just I:R+ les
21
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
Metadata changes triggers 412 code
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
Metadata changes triggers 412 code
Upgrade safe and less error prone:
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
Metadata changes triggers 412 code
Upgrade safe and less error prone:
! avoids breaking the app
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
Metadata changes triggers 412 code
Upgrade safe and less error prone:
! avoids breaking the app
! avoid 500 and 404 errors
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
Metadata changes triggers 412 code
Upgrade safe and less error prone:
! avoids breaking the app
! avoid 500 and 404 errors
Components can:
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
Metadata changes triggers 412 code
Upgrade safe and less error prone:
! avoids breaking the app
! avoid 500 and 404 errors
Components can:
! reuse metadata
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! By making metadata driven changes:
Save JS components re-minication
Metadata changes triggers 412 code
Upgrade safe and less error prone:
! avoids breaking the app
! avoid 500 and 404 errors
Components can:
! reuse metadata
! read metadata from di!erent locations and mix
them to achieve nal UI
22
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
23
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! See how it looks like before changing
and deploying
23
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! See how it looks like before changing
and deploying
Change metadata on browsers console
Q]]I"')404)4I8')/,0*%'abQ$$,*()+bcI;&'^
+I5'$,50I"')4I]4('%+DJFI$,%*"(+ 3 U
23
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! See how it looks like before changing
and deploying
Change metadata on browsers console
Q]]I"')404)4I8')/,0*%'abQ$$,*()+bcI;&'^
+I5'$,50I"')4I]4('%+DJFI$,%*"(+ 3 U
Change templates on browsers console
Q]]I)'"]%4)'I+')d&'%0!+')e&'^!+')f4#,*)
23
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! See how it looks like before changing
and deploying
Change metadata on browsers console
Q]]I"')404)4I8')/,0*%'abQ$$,*()+bcI;&'^
+I5'$,50I"')4I]4('%+DJFI$,%*"(+ 3 U
Change templates on browsers console
Q]]I)'"]%4)'I+')d&'%0!+')e&'^!+')f4#,*)
Call 5'(0'5ac or navigate to the view again
(to see applied changes)
23
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
24
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Integrations are faster
24
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Integrations are faster
use browsers console to call remote code
24
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Integrations are faster
use browsers console to call remote code
use %,40g4)4ac to make remote calls
24
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Integrations are faster
use browsers console to call remote code
use %,40g4)4ac to make remote calls
pass remote information to the 5'(0'5ac if
not disposed
24
2013 SugarCRM Inc. All rights reserved.
Tweaking Sugar faster
! Integrations are faster
use browsers console to call remote code
use %,40g4)4ac to make remote calls
pass remote information to the 5'(0'5ac if
not disposed
I:R+ le can be used to show the remote
data or a remote template can be used to
keep the template updated from remote
service
24
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Views that use Dashlet plugin
25
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Views that use Dashlet plugin
25
C
Classes
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Views that use Dashlet plugin
25
A
C
B
Classes
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Views that use Dashlet plugin
25
A
C
B
Classes
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Views that use Dashlet plugin
25
A
C
B
X
Plugins
Classes
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Views that use Dashlet plugin
25
A
C
B
A
B
X
Plugins
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Views that use Dashlet plugin
25
C
A
B
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Anatomy
! View
26
.h66 III!$%&'()+!R4+'!;&'^+!"#604+:%')!"#604+:%')I:R+ 661
.:X1i'%%, ^,5%0 Nc.!:X1
.:Y1_'%$,"' ), =/=Q j45)('5 9*""&) JEGU.!:Y1
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Anatomy
! Controller
27
!! III!$%&'()+!R4+'!;&'^+!"#604+:%')!"#604+:%')I`+
aK
]%*8&(+N Dbg4+:%')bF
Oc
2013 SugarCRM Inc. All rights reserved.
Dashlets
! 7.x
Anatomy
! Metadata
28
!! III!$%&'()+!R4+'!;&'^+!"#604+:%')!"#604+:%')I]:]
k;&'^0'7+DbR4+'bFDb;&'^bFDb"#604+:%')bF 3 4554#a
b04+:%')+b 31 4554#a
4554#a
b%4R'%b 31 bflfC/mCgQ9if=>bP
b0'+$5&])&,(b 31 bflfC/mCgQ9if=>Cg=9nopj>pA\bP
b$,(7&8b 31 4554#acP
b]5';&'^b 31 4554#acP
cP
cP
cq
2013 SugarCRM Inc. All rights reserved.
Dashlets
29
2013 SugarCRM Inc. All rights reserved.
Dashlets
29
2013 SugarCRM Inc. All rights reserved.
Dashlets
30
!! III!$%&'()+!R4+'!;&'^+!"#604+:%')!"#604+:%')I`+
aK
]%*8&(+N Dbg4+:%')bFP
%,40g4)4N 7*($)&,( ac K
;45 '(0],&() 3 b:))]+N!!4`4[I8,,8%'4]&+I$,"!4`4[!+'5;&$'+!+'45$:!('^+?;3GIEbP
@*'5# 3 b+*845$5"bP
%&"&) 3 Xq
kI4`4[aK
*5%N '(0],&() r bB@3b r @*'5# r bB5+s3b r %&"&)P
04)4>#]'N b`+,(]bP
+*$$'++N 7*($)&,( a04)4c K
&7 a):&+I0&+],+'0c K
5')*5(q
O
CI'[)'(0a):&+P 04)4cq
):&+I5'(0'5acq
OP
$,()'[)N ):&+
Ocq
O
Oc
2013 SugarCRM Inc. All rights reserved.
Dashlets
31
.h66 III!$%&'()+!R4+'!;&'^+!"#604+:%')!"#604+:%')I:R+ 661
KK-&7 5'+],(+'g4)4I5'+*%)+OO
KK-'4$: 5'+],(+'g4)4I5'+*%)+OO
.0&; $%4++3Z('^+645)&$%'Z1
.:X1.4 :5'73ZKK):&+I*('+$4]'0t5%OOZ1KKK):&+I)&)%'\,d,5"4))&(8OOO.!41
.!:X1 aKKK):&+I]*R%&+:'5OOOc
.]1KKK):&+I$,()'()OOO.!]1
.!0&;1
KK!'4$:OO
KK'%+'OO
.0&; $%4++3ZR%,$H67,,)'5Z1KK+)5 ZflfC\ACgQ>QCQeQpfQlf=ZOO.!0&;1
KK!&7OO
2013 SugarCRM Inc. All rights reserved.
Dashlets
32
2013 SugarCRM Inc. All rights reserved.
Handlebars
33
2013 SugarCRM Inc. All rights reserved.
Handlebars
! Wrap-up
33
2013 SugarCRM Inc. All rights reserved.
Handlebars
! Wrap-up
Simple conditions
33
2013 SugarCRM Inc. All rights reserved.
Handlebars
! Wrap-up
Simple conditions
this.* completely available on view
33
2013 SugarCRM Inc. All rights reserved.
Handlebars
! Wrap-up
Simple conditions
this.* completely available on view
Avoid using {{{
33
2013 SugarCRM Inc. All rights reserved.
Handlebars
! Wrap-up
Simple conditions
this.* completely available on view
Avoid using {{{
Use Handlebars.SafeString() with care
33
2013 SugarCRM Inc. All rights reserved.
Handlebars
! Wrap-up
Simple conditions
this.* completely available on view
Avoid using {{{
Use Handlebars.SafeString() with care
Sugar7 + Sidecar have a set of Handlebars
Helpers
33
2013 SugarCRM Inc. All rights reserved.
Questions?
34
2013 SugarCRM Inc. All rights reserved.
Practice
! Download latest version
! Build Sugar
! Start customizing using metadata only
! Create some modules/dashlets
! Check for memory leaks (using
Chrome)
35
2013 SugarCRM Inc. All rights reserved.
Questions?
36

Vous aimerez peut-être aussi