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.
Version 1.0.0 (released 1 April 2018) of the extension contains the following features:
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.
- 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.
- 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.
- 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.
- Sage CRM Web Page
This template can be used generate a simple Web page that can be used for almost any purpose.
||Code snippet for creating a method in the AppFactory class to expose a WebObject to Sage CRM.|
||Code snippet for creating a BuildContents method that override the BuildContents method.|
||Code snippet for creating a chart that can be inserted into a Sage CRM page.|
||Code snippet for creating a Confirm Button that can be used to confirm an action with the user.|
||Code snippet for creating an Entry Group that can be rendered on a Sage CRM page.|
||Code snippet for searching for a particular instance of an entity. This done by providing a Entity Name and Where Clause.|
|Get Context Info||
||Code snippet for getting a particular field of a particular entity that is currrently in context.|
||Code snippet adding a GraphicBlock to a page in Sage CRM.|
||Code snippet for creating a Help Button that will provide the user with help when clicked.|
||Code snippet for creating a Horizontal Panel element to render on a Sage CRM page.|
||Code snippet for creating an HTML Grid in Sage CRM.|
||Code snippet that adds a list to a page in Sage CRM.|
||Code snippet creating a new Record object for an Entity.|
||Code snippet for getting a QuerySelect object in a Sage CRM page.|
||Code snippet for creating a Submit Button that can be used to submit an HTML Form in Sage CRM.|
||Code snippet for creating a URL Button that can link to any other page in Sage CRM.|
||Code snippet creating a Vertical Panel that can be rendering in a Sage CRM page.|
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.
Installing the extension through Visual Studio (Recommended)
- Open Visual Studio
- Go to Tools -> Extensions and Updates...
- Select the Online category in the left panel and search for Sage CRM .NET Templates
- Install the Sage CRM .NET Templates extension by Ivan Kahl
- Restart Visual Studio and you're good to go!
Downloading the VSIX from Visual Studio Marketplace and then installing it
- Go and download Sage CRM .NET Templates on the Visual Studio Marketplace.
- Close all instances of Visual Studio that are running.
- Run the downloaded VSIX and follow the prompts.
- Start Visual Studio and you’re good to go!
Creating your first project
- Choose a project that you want to create from the Sage CRM category
- Add a reference to the SageCRMNet.dll
- Make any modifications you may need to the project
- 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.
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.