Taking Advantage of Web Resources

advertisement
Taking Advantage of Web
Resources
Presented By:
Sebastian
Waksmundzki
AlfaPeople
Prague
April 3 - 6, 2011
For Microsoft Dynamics CRM Partners
WhoAmiRequest
• Senior Dynamics Architect @ AlfaPeople
– 10 Years Experience
– Still love technology
– CRM, SharePoint, ERP(s)
• Social
– Blog www.mindthecloud.net
– Twitter @qmiswax
For Microsoft Dynamics CRM Partners
Agenda
• Web Resources
– Capabilities
– Limitations
• Real Life
– Virtual Paths
– Demo
– Tools
• Web Resources and Solutions
• Q&A
For Microsoft Dynamics CRM Partners
For Microsoft Dynamics CRM Partners
What are Web Resources
• Long long time ago (v4) there was only
chaos…
• Now: Virtual files
– stored in the DB
– unique URL address
• On-premise and Online
– https://MyOrganization.crm.dynamics.com/WebResources/
– http://myServer/MyOrganization/WebResources/
For Microsoft Dynamics CRM Partners
Web Resource Types
File
File extensions
Type
Web Page (HTML)
.htm, .html
1
Style Sheet (CSS)
.css
2
Script (JScript)
.js
3
Data (XML)
.xml
4
Image (PNG)
.png
5
Image (JPG)
.jpg
6
Image (GIF)
.gif
7
Silverlight (XAP)
.xap
8
StyleSheet (XSL)
.xsl, .xslt
9
Image (ICO)
.ico
10
For Microsoft Dynamics CRM Partners
Capabilities
• Used to extend the Microsoft
Dynamics CRM Web application
• Reusability of code (JS Libraries)
• Familiar technologies for developers
• Pack and go deployment model
• Accessible via SDK
• Available offline
For Microsoft Dynamics CRM Partners
Limitations
• Only client side
• Only for licensed Microsoft
Dynamics CRM users (CRM security
context)
• Organization.MaxUploadFileSize
property
• One missing type (.aspx) to execute code
on the server 
For Microsoft Dynamics CRM Partners
JavaScript Library
• JScript libraries are reusable
– Up to 50 scripts per entity form
– Up to 50 functions as event handlers
• Execution Context
– to determine Depth, Event Source, shared
variables
For Microsoft Dynamics CRM Partners
Common Functions
function changeElementBackground(elementName, colour) {
$(elementName).css("backgroundColor", colour);
}
function highlightControlText(controlName, colour) {
$('#' + controlName).css("color", colour);
}
function highlightBackground(controlName, colour) {
$('#' + controlName).css("backgroundColor", colour);
}
For Microsoft Dynamics CRM Partners
Demo of JS library
For Microsoft Dynamics CRM Partners
Execution Context
• Passed to Jscript function as first
parameter
• Tells you about object generated the event
For Microsoft Dynamics CRM Partners
Execution context
function DoSomething(context)
{
var oField = context.getEventSource().getValue();
if (typeof(oField) != "undefined" && oField != null)
{
}
context.getEventSource().setValue(“whatever”);
}
For Microsoft Dynamics CRM Partners
Look and feel with data
• Look and feel: HTML pages
(css)/Silverlight
• Data: REST
– Html page + jquery
– Silverlight
For Microsoft Dynamics CRM Partners
REST
Microsoft Dynamics CRM Implementation of
REST (Odata)
[Your Organization Root URL]/xrmservices/2011/organizationdata.svc
OData Entity Data Model (EDM)
[Your Organization Root URL]/xrmservices/2011/organizationdata.svc/$metadata
For Microsoft Dynamics CRM Partners
REST ()
OData Query Designer
http://crm2011odatatool.codeplex.com
CrmRestKit (Dynamics CRM 2011)
http://crmrestkit.codeplex.com/
For Microsoft Dynamics CRM Partners
CrmRestKit
// CREATE
var contact = CrmRestKit.Create('Contact', { FirstName: ‘Seb', LastName: ‘W' });
// RETRIEVE
CrmRestKit.Retrieve('Contact', contact.ContactId, ['ContactId', 'ParentCustomerId'],
function (contact) {
var contactId = contact.ContactId;
// ...
});
For Microsoft Dynamics CRM Partners
Passing Parameters html
Parameter
Name
Description
typename
Entity Name
The name of the entity
type
Entity Type Code
An integer that uniquely
identifies the entity in a
specific organization.
id
Object GUID
The GUID that represents a
record.
orgname
Organization Name
The unique name of the
organization.
User Language Code
The language code
identifier being used by the
current user.
orglcid
Organization Language
Code
The language code
identifier that represents
the base language for the
organization.
data
Optional Data Parameter
An optional value that may
be passed.
userlcid
For Microsoft Dynamics CRM Partners
Virtual/Relative paths
• WebResources can be developed and
tested outside of Microsoft Dynamics CRM
2011 and then imported
• Virtual folder structure
For Microsoft Dynamics CRM Partners
Demo (Geo Locate)
For Microsoft Dynamics CRM Partners
Object Model
For Microsoft Dynamics CRM Partners
Images
•
•
•
•
•
JPG, PNG, GIF
Ribbon $webresource Directive
Custom entity icons
Background for html
Custom form features
For Microsoft Dynamics CRM Partners
Data (XML)
• Save and access data
• Cache data that you want to use in your
solution
• This is not another DB
For Microsoft Dynamics CRM Partners
Tools
• Web Resource Utility
• Minify (PowerShell)
• CRM 2011 Dev Toolkit
– see Marco Amoedo and his session
For Microsoft Dynamics CRM Partners
Solution Management
For Microsoft Dynamics CRM Partners
Demo (Tools)
For Microsoft Dynamics CRM Partners
Sebastian Waksmundzki
AlfaPeople
swa@alfapeople.com
Thank You for Attending extreme 2011!
Please remember to fill out your session evaluation form.
For Microsoft Dynamics CRM Partners
Download