/
Sage CRM Developers Course Sage CRM Developers Course

Sage CRM Developers Course - PowerPoint Presentation

rayfantasy
rayfantasy . @rayfantasy
Follow
342 views
Uploaded On 2020-08-27

Sage CRM Developers Course - PPT Presentation

Using the NET API 1 Looking ahead to the classes DP01 Introduction to the Development Partner Program DP02 Entities and the Data Model Part 1 of 2 DP03 Entities and the Data Model Part 2 of 2 ID: 804777

sage crm net api crm sage api net part web class dll pages method custom asp data system application

Share:

Link:

Embed:

Download Presentation from below link

Download The PPT/PDF document "Sage CRM Developers Course" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Sage CRM Developers Course

Using

the .NET API (

1

)

Slide2

Looking ahead to the classes

DP01: Introduction to the Development Partner Program

DP02: Entities and the Data Model (Part 1 of 2)

DP03: Entities and the Data Model (Part 2 of 2)

DP04: Implementing Screen Based Rules (Part 1 of 2)DP05: Implementing Screen Based Rules (Part 2 of 2)DP06: Screen and User Independent Business RulesDP07: Workflow (Part 1 of 2)DP08: Workflow (Part 2 of 2)DP09: Using the API Objects in ASP Pages (Part 1 of 2)DP10 : Using the API Objects in ASP Pages (Part 2 of 2)

DP11: Using the Component Manager

DP12: Programming for the Advanced Email Manager

DP13: Using the Web Services API

DP14: Using the Web Services API (Part 2 of 2)

DP15: Coding the Web Self Service COM API (Part 1 of 2)

DP16: Coding the Web Self Service COM API (Part 2 of 2)

DP17: Using the .NET API (Part 1 of 2)

DP18: Using the .NET API (Part 2 of 2)

Slide3

Agenda

About the .NET API

The Architecture and how the .NET assemblies link to the CRM Interface

The SDK and ResourcesCreating a First Project: Hello World Designing Simple Web Pages using the Web Class

Note: This presentation assumes you are using Sage CRM 6.2g or Sage CRM 7.0c or later.

Slide4

About the .NET API

Slide5

About the .NET API

Sage CRM Application Extensions are .NET projects or assemblies (

dlls) that implement custom behaviour.API slightly updated

and changed for Sage CRM 6.2g and Sage CRM 7.0cPart of a strategy of choice for development partners.

It expands the range of tools to allow integrations to be developedAvailable for Development Partners and Internal Sage OpCo development team use onlyTo prove the API it is being used to develop new features (similar to early usage of COM ASP API)

Slide6

.NET API

.NET API is not a replacement for ASP COM API

Bug fixes and improvements to COM API continue

You can code with what ever .NET language you like e.g. C#, VB.net

Tight integration with Existing systemExposes deeper and richer functionality than COM APIDesigned for functionality. (COM designed for simplicity)Sophisticated design environment availableBy using Sage CRM meta data Application Extensions constructed using the Sage CRM .NET API will look, feel and perform exactly like core system pages.Compiled end product (human non-readable)Protection for Intellectual PropertyCan not just ‘tweak’ a line – Development Cycle Implied

Drop in Deployment – NO IISRESET required

.NET API methods manage all HTTP interaction and do NOT use ASP.NET classes or ASP Objects

Reference to the Sage CRM .NET component from within ASP.NET projects is not supported.

Slide7

Slide8

CustomDotNetDll

action calls Application extension

CustomDotNetDll

action uses COM

interop to trigger behaviour in CRM .NET Component.Passes CRM Application Extension DLL name and session informationCalls CRM Application ExtensionCRM Application Extension processes data and generates and returns HTML

Slide9

Calling .NET Application Extensions

From Tabs/Menus

Action:

CustomDotNetDllCustom DOT NET DLL Name

Method NameFrom List Block HyperlinksHyperlink toCustomDotNetDllCustom DOT NET DLL NameCustom ID FieldMethod NameFrom Application Extension Buttons string sUrl = UrlDotNet(ThisDotNetDll, "RunViewOpportunity");

AddUrlButton("Cancel", "Cancel.gif", sUrl);

From ASP Pages

mycontainer.AddButton

(

CRM.Button

("Add","new.gif",

CRM.Url

("myproject.dll-

RunMyCustomPage

")))

Redirection from other DLLs

Slide10

The SDK and Resources

Slide11

New Resources available for Development Partners

.NET Developers Guide

Revised Class Diagram

Advanced Customization Wizard

Updated SDKCRM Entity Template reflects new class constructorsNew SnippetsSample Projects include source code for RelatedEntity module.Developers Site

Free Online Classes and recorded sessions

Training Material

Slide12

SDK Files

Slide13

Main Features of API

Workflow support added

Workflow Buttons available

DebuggingSimplification and standardization of API code. This will require existing developments to edit code base.

Assemblies created for 6.1 will not work with 6.2 & 7.0Assemblies created for 6.2 & 7.0 will not work with 6.1Easy constructor mechanism for specialist classesDataPageDataPageDeleteDataPageEditDataPageNew

ListPage

SearchPage

Component Manager

Delivery of .NET component files

Extended SDK

Related Entities Feature

A case study in .NET

Calling from the API

Sample Code available only post release

Slide14

Assemblies

SageCrmNet.dll and SageCRMWrapper.dll added to Global Assembly Cache during installation

C:\windows\assembly

SageCRMNet.dll

SageCRMWrapper.dllReference PathC:\Program Files\Sage\CRM\CRMDotNet

\6.2\SageCRMNet.dll

C:\Program Files\Sage\CRM\

CRMDotNet

\7.0\SageCRMNet.dll

C:\Program Files\Sage\CRM\

CRMDotNet

\7.1

Slide15

Tip: Use Object Browser to Examine Namespaces

Slide16

Namespaces

Sage

Sage.CRM.BlocksSage.CRM.Controls

Sage.CRM.DataSage.CRM.Errors

Sage.CRM.GraphicsSage.CRM.HTMLSage.CRM.UISage.CRM.UtilsSage.CRM.WebObject

Slide17

Sage.CRM.Controls

Entry

EntryAdvSearchSelectEntryCustom

EntryGroupEntrySelect

EntrySelectTableGridColGridColCheckBoxListEntryAdvSearchSelectClass used to represent Advanced Select Search EntryEntryCustom

Class to represent a Custom Entry

GridColCheckBox

Provides capability to specify a

CheckBox

Column to be added to List Grid

Slide18

Sage.CRM.WebObject

DataPageBase

Abstract class to all Data Pages

DataPage

DataPageBaseDataPageDeleteDataPageEditDataPageNewListPageSearchPageWeb

Slide19

Sage.CRM.Utils

Dispatch

KeysMetadataTableInfo

TranslationFamilyUserSession

Slide20

Sage.CRM.UI

Objects

ComplexBoxContentBox

HorizontalPanelHTMLStringHyperlinkImageLink

ImageObjectPanelUIEntryUIObjectVerticalPanelThis namespace contains objects which allow better control of the positioning of screen elements.Much easier to create complex screensLists with detail screensComplex ‘button’ groupsStacked or side-by-side lists

Custom entry screens

Discussed in later slides

Slide21

Starting a Project

Using the Sage CRM

.NET API for Sage CRM

Slide22

Create a new project: Basic Template

Note: Sage CRM Templates found under Visual C# templates

CRM Entity Template

Use this to create a project that will generate screens for working on a new CRM entity

CRM Basic TemplateCreate a new application extension for Sage CRM

Slide23

Creating a first project with

Basic

Template

Check that the project references are correct

Project automatically createsBase ClassExample Custom Page

Slide24

Change Build Location for Quick Testing

Slide25

CRM Entity Template

Template will create example pages for a new entity

You will need to ‘Load Project Normally’

Template DOES NOT

Carry out database tasks – the new table is not createdCarry out Meta Data changes – new screens and lists are not createdTips: If using the wizard it is recommended to create a new dll for each entity

Create the new Table using the Advanced Customization Wizard (Main Entity Wizard) to have table, screens and lists created

Slide26

Base Class

using System;

using System.Collections.Generic;

using System.Text;

using Sage.CRM.WebObject;namespace Sample1{ //Every thing should be declared in same namespace. //static class AppFactory is REQUIRED! public static class AppFactory

{

/*

* Name of Method here is what you enter into CRM admin as the Method

* name when adding new tab with action CustomDotNetDll

*

*/

public static void RunHelloWorld(ref Web AretVal)

{

AretVal = new HelloWorld();

}

}

}

Typically All classes within same namespace

Must contain

public static class AppFactory

This contains the methods that are called by CRM. These in turn reference others.

RunTask Method

May contain calls to other tasks but can not use CRM classes

Note:

The

ref

keyword on a method parameter causes a method to refer to the same variable that was passed as an input parameter for the same method. If you do any changes to the variable, they will be reflected in the variable.

Slide27

Creating a Simple Web Class

using System;

using System.Collections.Generic;

using System.Text;

using Sage.CRM.WebObject;using Sage.CRM.Controls;using Sage.CRM.Data;using Sage.CRM.Utils;namespace Sample1{

public class HelloWorld : Web

{

public override void BuildContents()

{

}

}

}

BuildContents

Override this to build your own page

Slide28

Simple Methods

GetTabs()

GetTabs(“Tabgroup Name”)

AddContent("")

Method used to add HTML to the page that you are building.AddContent("<marquee>Hello World</marquee>");AddContent("Hello World", "InfoContent");AddInfo("Hello World");

AddButtonContent("<div class= viewbox>hello</div> ");

AddHeaderContent("custom content goes here");

Slide29

Error Handling and Error Messages

Error Related Methods available

AddErrror(“Message”)

LogMessage("Hello World", 5);

Standard Dot Net log LogMessage("myfile", "Hello World", 5); Custom Log

try

{

//code goes here

}

catch (Exception e)

{

AddError(e.Message);

}

Handle different types of exceptions e.g.

ArithmeticException

OverFlowExceptions

FormatExceptions

Slide30

Adding Client Side Code

AddHeaderScript

Add JavaScript to the <Head> section of the page

This can use the new Client Side API

string

strHS

= "

crm.ready

(function(){

crm.infoMessage

(‘Hello World’);})";

AddHeaderScript

(

strHS

);

Note: Custom Script Library files in Sage CRM v7.2 are automatically available to .NET assemblies

C:\Program Files (x86)\Sage\CRM\CRM\

WWWRoot

\

js

\custom

Slide31

Important Objects

Sage.CRM.Utils.Metadata

Methods to GetScreen and GetList and GetTranslation (discussed later)

Sage.CRM.Utils.CurrentUserAll info on the currently logged on userSage.CRM.HTML.HTMLBuilder

Methods for wrapping up text in HTML tables and TRs and TD etc. (discussed later)Sage.CRM.Utils.DispatchMethods for starting/committing transactions and getting locks, also gives access to content and query fields.

Slide32

User, Session and System Information

CurrentUser

Available in BuildContents

AddInfo(CurrentUser.UserName);User Preferences

AddInfo(CurrentUser[Sage.UserOptions.GridSize]);GetContextInfo()AddInfo(GetContextInfo("user","user_lastname"));AddInfo(GetContextInfo("selecteduser","user_lastname"));Key InformationAddInfo(Sage.KeyList.UserId.ToString());NB This will retrieve the UserID in keys NOT the owner of the session.Identify Dominant Key

int iDomKey = Keys[(int)Sage.KeyList.DominantKey];

System Parameters (from custom_sysparams)

AddInfo(Metadata.GetParam(Sage.ParamNames.GlobalTemplateDocStore))

DLL and Method Information

AddInfo(ThisDotNetDll +"/"+ ThisDotNetFunction);

Useful for building URLs in buttons and redirects

HTTP Information

AddInfo(Dispatch.ServerVariable("HTTP_REFERER"));

Slide33

Themes, Translations and Captions

Slide34

.NET Pages and Themes

Themes are automatically picked up for main pages

When building custom paths can use

CurrentUser.Virtua

lImgPath()E.g. /crm62/Themes/img/default/

Slide35

Handling Translations

Explicit Use

GetTranslation method

Implicit UseButtons automatically use the Caption Family “Buttons”

AddUrlButton("edit", "edit.gif", strURL);Name and Translations may hold apostrophes (GetJsString)string strMessage = Metadata.GetTranslation("GenCaptions", "UserWizardInstruction");string strScript = "javascript:window.alert('"+GetJsString(strMessage)+"')";AddUrlButton("edit", "edit.gif", strScript);

Slide36

Interacting with Translation Families

Sage.CRM.Utils

. TranslationFamilyTranslationFamily

tf = new TranslationFamily(“

testset");tf.Add("test1", "Test1 Value");tf.Add("test2", "Test2 Value");tf.Add("test3", "Test3 Value");tf.Add("test4", "Test4 Value");AddContent(tf["test1"]);

Slide37

Adding Coaching Captions to a screen

Automatic Behavior

Use Inline Coaching editing to add caption to screen.Caption added will behave as default captions

Slide38

Q&A

Slide39

Looking ahead to the classes

DP01: Introduction to the Development Partner Program

DP02: Entities and the Data Model (Part 1 of 2)

DP03: Entities and the Data Model (Part 2 of 2)

DP04: Implementing Screen Based Rules (Part 1 of 2)DP05: Implementing Screen Based Rules (Part 2 of 2)DP06: Screen and User Independent Business RulesDP07: Workflow (Part 1 of 2)DP08: Workflow (Part 2 of 2)DP09: Using the API Objects in ASP Pages (Part 1 of 2)DP10 : Using the API Objects in ASP Pages (Part 2 of 2)

DP11: Using the Component Manager

DP12: Programming for the Advanced Email Manager

DP13: Using the Web Services API

DP14: Using the Web Services API (Part 2 of 2)

DP15: Coding the Web Self Service COM API (Part 1 of 2)

DP16: Coding the Web Self Service COM API (Part 2 of 2)

DP17: Using the .NET API (Part 1 of 2)

DP18: Using the .NET API (Part 2 of 2)

Slide40