Sage CRM Developers Course Using the API Objects
Sage CRM Developers Course Using the API Objects in ASP Pages (1)
Looking ahead to the classes DP 01: Introduction to the Development Partner Program DP 02: Entities and the Data Model (Part 1 of 2) DP 03: Entities and the Data Model (Part 2 of 2) DP 04: Implementing Screen Based Rules (Part 1 of 2) DP 05: Implementing Screen Based Rules (Part 2 of 2) DP 06: Screen and User Independent Business Rules DP 07: Workflow (Part 1 of 2) DP 08: Workflow (Part 2 of 2) DP 09: Using the API Objects in ASP Pages (Part 1 of 2) DP 10 : Using the API Objects in ASP Pages (Part 2 of 2) DP 11: Using the Component Manager DP 12: Programming for the Advanced Email Manager DP 13: Using the Web Services API DP 14: Using the Web Services API (Part 2 of 2) DP 15: Coding the Web Self Service COM API (Part 1 of 2) DP 16: Coding the Web Self Service COM API (Part 2 of 2) DP 17: Using the. NET API (Part 1 of 2) DP 18: Using the. NET API (Part 2 of 2)
Agenda Using the API objects in ASP Pages Linking to External Databases Extending the Data Model Basic Data Handling within an ASP Page Listing Data Editing Data Adding Data
Creating a Page
Standard include files sagecrm. js reference in Java. Script-based ASP pages. This file sets the default language to Java. Script. (Default for Sage CRM v 7. x) sagecrmnolang. js this file does not set the default language. (Default for Sage CRM v 7. x) accpaccrm. js reference in Java. Script-based ASP pages. This file sets the default language to Java. Script. accpacnolang. js this file does not set the default language. ewaress. js reference in Java. Script-based, Self Service ASP pages.
sagecrmnolang. js file CRM = Server. Create. Object("e. Ware. CRM"); e. Msg = CRM. Init( Request. Querystring, Request. Form, Request. Server. Variables("HTTPS"), Request. Server. Variables("SERVER_NAME"), false, Request. Server. Variables("HTTP_USER_AGENT"), Accept);
Developer Include Files Received when DP joins program. sagecrmdpp. js Sagecrmnolangdpp. js sagecrmdpp. vbs accpaccrmdpp. js accpaccrmnolangdpp. js accpaccrmdpp. vbs Include the appropriate files in your third-party products/installs. These files are supplied to CRM Development Partners only. They will enable your product to run on the CRM installs that do not have the Enterprise Integration Server (EIS). Products using the standard accpaccrm. js will not run on systems without EIS.
Connecting to an external Database Making a permanent database connection Making a 3 rd Party table work like a CRM table select * from custom_databases
New Entities Full Customization of new screens, lists and views Full use of field and table level scripts Governed by Security Territories Workflow can be built Automatic System Policing of insert by, update by and timestamps Available for reporting and target lists CREATE TABLE [dbo]. [Project] ( [PROJ_Project. Id] [int] IDENTITY (1, 1) NOT NULL , [PROJ_Primary. Company. Id] [int] NULL , [PROJ_Primary. Person. Id] [int] NULL , [PROJ_Assigned. User. Id] [int] NULL , [PROJ_Channel. Id] [int] NULL , [PROJ_Description] [char] (40) NULL , [PROJ_Created. By] [int] NULL , [PROJ_Created. Date] [datetime] NULL , [PROJ_Updated. By] [int] NULL , [PROJ_Updated. Date] [datetime] NULL , [PROJ_Time. Stamp] [datetime] NULL , [PROJ_Deleted] [tinyint] NULL , [PROJ_Segment. ID] [int] NULL , [PROJ_Sec. Terr] [int] NULL , [PROJ_Workflow. Id] [int] NULL )
ASP Example Screenflow
New Entity Tasks Create New Project Table Must have core columns as discussed in documentation If list calls proj_status "selection as gif" add folder and images Create calls to asp pages from menus Link new project table to CRM. Add additional columns to create relationships Create screens Admin>Customization>System>find Admin>Customisation>System>new – – Create asp pages entity. Web. Picker entity. Detail. Box entity. Search. Box entity. Top. Content Create a view that will exclude deleted entities. e. g. select * from project where proj_deleted is null Create lists with appropriate hyperlinks entitylist entitygrid Create Tab bar for new entity(with same name as entity) Project projectnew. asp projectsummary. asp projectfind. asp projectlist. asp Create workflow project workflow
Naming Conventions Suggested Naming Convention for new Entity Blocks Screens – entity. Web. Picker – entity. Detail. Box – entity. Search. Box – entity. Top. Content Lists – entity. Grid – entity. List ASP pages entity. Find. asp entity. New. asp entity. Summary. asp entity. User. asp entity. Entity. asp – (for listing children of new entity from entities tab bar)
Typical Tasks Create a List Page Create an Insert Page Create an Edit Page Handling deletes Create a Search Page
List Page Structure var my. Block = CRM. Get. Block('opportunitylist'); var my. Record. Id = CRM. Get. Context. Info('company', 'comp_companyid'); var Arg = 'oppo_primarycompanyid='+my. Record. Id CRM. Add. Content(my. Block. Execute(Arg)); Response. Write(CRM. Get. Page());
Edit Page Structure var my. Block = CRM. Get. Block('Opportunity. Detail. Box'); var my. Record. Id = CRM. Get. Context. Info('Opportunity', 'oppo_opportunityid'); //var my. Record. Id = Request. Query. String('oppo_opportunityid'); var my. Record = CRM. Find. Record('Opportunity', 'oppo_opportunityid='+my. Record. Id); CRM. Add. Content(my. Block. Execute(my. Record)); Response. Write(CRM. Get. Page());
Adding Buttons //Example to call an inbuilt CRM action e. g 130 is find company var str. Find. Company. Button = CRM. Button('search', 'search. gif', CRM. Url(130)); //Example to call a Custom ASP page var str. Call. ASPButton = CRM. Button('ASP', 'save. gif', CRM. Url('my. Page. asp')); //Example to show control of buttons display on screen using entity security //The following button is only available for users with insert rights on company entity (see security) var str. New. Company. Security. Button = CRM. Button('New', 'newcompany. gif', CRM. Url(1200), 'COMPANY', 'INSERT'); //Example to show to build a custom help button var help. File = "FI_Searching. For. Company. htm"; var str. Custom. Help. Button =CRM. Button("Help", "help. gif", "javascript: window. open('/"+s. Install. Name+"/help/EN/Main Menu/Default_CSH. htm#User/"+help. File+"', 'HELPWIN', 'scrollbars=yes, toolbar=no, menubar=no, resizable=yes, top=200, width=600, height=400'); "); re = /href/gi; str. Custom. Help. Button = str. Custom. Help. Button. replace(re, "onclick"); my. Block. Add. Button(str. Find. Company. Button); my. Block. Add. Button(str. Call. ASPButton); my. Block. Add. Button(str. New. Company. Security. Button); my. Block. Add. Button(str. Custom. Help. Button);
Add Page Structure if(CRM. Mode ==View) { CRM. Mode = Edit; } var my. Block = CRM. Get. Block('opportunitydetailbox'); var my. Record = CRM. Create. Record('Opportunity'); my. Record. oppo_stage= 'Lead'; my. Record. oppo_status= 'In Progress'; my. Record. oppo_primarycompanyid= CRM. Get. Context. Info('Company', 'comp_companyid'); my. Record. oppo_primarypersonid= CRM. Get. Context. Info('person', 'pers_personid'); CRM. Add. Content(my. Block. Execute(my. Record)); Response. Write(CRM. Get. Page()); if(CRM. Mode == Save) { Response. Redirect(CRM. URL('customoppolist. asp')) }
Q&A
Looking ahead to the classes DP 01: Introduction to the Development Partner Program DP 02: Entities and the Data Model (Part 1 of 2) DP 03: Entities and the Data Model (Part 2 of 2) DP 04: Implementing Screen Based Rules (Part 1 of 2) DP 05: Implementing Screen Based Rules (Part 2 of 2) DP 06: Screen and User Independent Business Rules DP 07: Workflow (Part 1 of 2) DP 08: Workflow (Part 2 of 2) DP 09: Using the API Objects in ASP Pages (Part 1 of 2) DP 10 : Using the API Objects in ASP Pages (Part 2 of 2) DP 11: Using the Component Manager DP 12: Programming for the Advanced Email Manager DP 13: Using the Web Services API DP 14: Using the Web Services API (Part 2 of 2) DP 15: Coding the Web Self Service COM API (Part 1 of 2) DP 16: Coding the Web Self Service COM API (Part 2 of 2) DP 17: Using the. NET API (Part 1 of 2) DP 18: Using the. NET API (Part 2 of 2)
- Slides: 21