Sage CRM .NET Templates Visual Studio Extension

When developing for Sage CRM, we have a choice of using ASP or .NET. In the spirit of writing code that is both reusable and readable we do almost all of our development for Sage CRM in .NET (Visual C# more specifically).

When developing for Sage CRM, we have a choice of using ASP or .NET. In the spirit of writing code that is both reusable and readable we do almost all of our development for Sage CRM in .NET (Visual C# more specifically). While using .NET has proved to be a lot more maintainable in the long-run, it can take considerably longer to create a project in Visual Studio and set it up with the correct classes needed for Sage CRM compared to just write an ASP page.

In an attempt to reduce the time it takes setting up and developing a .NET component, I’ve created a Visual Studio extension that contains various wizards that help you create projects and classes for Sage CRM quickly and easily. It also contains a collection of useful snippets for commonly-used methods and objects to help save time during development.

Features

Version 1.0.0 (released 1 April 2018) of the extension contains the following features:

Project Templates

  • Sage CRM Simple Project
    The Sage CRM Simple Project template lets you create a barebones Sage CRM .NET project with only an AppFactory class to expose methods to Sage CRM. You can then go and add whatever classes you need and simply expose them in the AppFactory.

  • Sage CRM Entity Project
    If you are creating a new entity in Sage CRM, you can use the Sage CRM Entity Project wizard to quickly create a Sage CRM .NET project with all the pages necessary to list, search, view, edit, create and delete instances of that new entity. The resulting project can be built immediately and imported into Sage CRM to be used. This makes it easy to use .NET when creating new entities instead of using the generated ASP pages from the Component Wizard (if you use it) which will make your project easier to maintain in the future.
    EntityProjectWizard-36526d8581a98c6261a82ac160d4a97b-5b7b5

Item Templates

  • Sage CRM AppFactory Class
    Create an AppFactory class that can be used to expose methods in the DLL to Sage CRM. You can then add methods to the AppFactory class to expose pages in the DLL to Sage CRM.
  • Sage CRM DataPage/DataPageDelete/DataPageEdit/DataPageNew
    The DataPage/DataPageDelete/DataPageEdit/DataPageNew wizards let you create pages to view, delete, edit and create new instances of an entity in Sage CRM. Once the page has been created, you can modify it if you want to although it will build without any modification.
    DataPageWizard-f47704fa426f4adb4668df6cb4ca2c84-5b7b5
  • Sage CRM ListPage Page
    As the name suggests, this page is used to list an entity collection. The generated page can be used immediately without any further modification.
    ListPageWizard-950770614716a178f8da0f04ea1dea30-5b7b5
  • Sage CRM SearchPage Page
    As the name implies, this page can be used to search an entity. This generated page that can be used right out the box.
    SearchPageWizard-bce1492435155eb6968c62c7c792a4d1-5b7b5
  • Sage CRM Web Page
    This template can be used generate a simple Web page that can be used for almost any purpose.

Snippets

Snippet Name Shortcut Description
AppFactory Method scafm Code snippet for creating a method in the AppFactory class to expose a WebObject to Sage CRM.
BuildContents Method scbcm Code snippet for creating a BuildContents method that override the BuildContents method.
Chart Graphic sccg Code snippet for creating a chart that can be inserted into a Sage CRM page.
Confirm Button sccb Code snippet for creating a Confirm Button that can be used to confirm an action with the user.
Entry Group sceg Code snippet for creating an Entry Group that can be rendered on a Sage CRM page.
Find Record scfr Code snippet for searching for a particular instance of an entity. This done by providing a Entity Name and Where Clause.
Get Context Info scgci Code snippet for getting a particular field of a particular entity that is currrently in context.
Graphic Block scgb Code snippet adding a GraphicBlock to a page in Sage CRM.
Help Button schb Code snippet for creating a Help Button that will provide the user with help when clicked.
Horizontal Panel schp Code snippet for creating a Horizontal Panel element to render on a Sage CRM page.
HTML Grid schg Code snippet for creating an HTML Grid in Sage CRM.
List scl Code snippet that adds a list to a page in Sage CRM.
New Record scnr Code snippet creating a new Record object for an Entity.
Query Select scqs Code snippet for getting a QuerySelect object in a Sage CRM page.
Submit Button scsb Code snippet for creating a Submit Button that can be used to submit an HTML Form in Sage CRM.
URL Button scub Code snippet for creating a URL Button that can link to any other page in Sage CRM.
Vertical Panel scvp Code snippet creating a Vertical Panel that can be rendering in a Sage CRM page.

Getting Started

Installing

You can install the extension by either installing the extension through Visual Studio or downloading the VSIX from the Visual Studio Marketplace and then installing it. I would suggest the former since this means that Visual Studio can update the extension automatically when a new version is released.

  1. Open Visual Studio
  2. Go to Tools -> Extensions and Updates...
    extensions_and_updates-ccca45f037dc7eab1be4b5a319bfc658-8f480-3
  3. Select the Online category in the left panel and search for Sage CRM .NET Templates
  4. Install the Sage CRM .NET Templates extension by Ivan Kahl
    sage_crm_dot_net_templates_item-48e8cad6615d2d9c7522f1ae12038bfa-52fd6
  5. Restart Visual Studio and you're good to go!

Downloading the VSIX from Visual Studio Marketplace and then installing it

  1. Go and download Sage CRM .NET Templates on the Visual Studio Marketplace.
    sage_crm_dot_net_templates-802c67a3f5ee71c33d8e425c41e5a851-5698a
  2. Close all instances of Visual Studio that are running.
  3. Run the downloaded VSIX and follow the prompts.
  4. Start Visual Studio and you’re good to go!

Creating your first project

  1. Choose a project that you want to create from the Sage CRM category
  2. Add a reference to the SageCRMNet.dll
  3. Make any modifications you may need to the project
  4. Build the project and deploy it to Sage CRM

A note on SageCRMNet.dll

You will notice that when you create a project, the SageCRMNet.dll is not included in the project. This is because the SageCRMNet.dll is part of the Sage CRM SDK which is only available to those with a Sage CRM Developer License. Once you have the assembly, just include it as a reference in the project and you will be able to build it.

Final Thoughts

I hope that the extension proves to be useful for you. If you have any improvements you would like to make to it, you are welcome to do so with a pull request. Please just make sure you read the Contributing document before-hand. Otherwise, if you have any feature requests or find a bug, please log them on GitHub and they will be attended to as soon as possible.