Select theme:
Radzen applications typically start from the data. You can use an existing database or REST API. In this case we will use a MS SQL database that we will create from scratch.
First you have to create the tables that will store the CRM data: Contacts, Opportunities and tasks.
Fire up SQL Management Studio (or your other favorite DB management tool) create a database called RadzenCRM
and add the following tables and foreign key relationships.
You can either create those visually or run this SQL script.
Now that we have a database for the CRM application it is time to start working in Radzen.
RadzenCRM
, select the Dark theme, pick a directory where the application files will reside and check the Server-side project (.NET Core). Radzen applications need a .NET Core project to create a REST API over your database. More info is available in the Architecture article. CRM
and Database to RadzenCRM
. Then enter the rest of the connection info - server name, user and password (if using SQL server authentication). RadzenCRM
database and infer its schema - tables, views and stored procedures (if there are any). You now have a complete CRUD application which is ready for test. Click the run button to see what you have created in your browser.
The application doesn't show much at the moment because the database is still empty. Let's add some data.
Inactive
, Won
, Lost
, Active
. Those represent the state a CRM opportunity could be in.
Then go to the Task Statuses page and add the following statuses: Not Started
, In Progress
, Complete
. Those represent the state a CRM task could be in.
Finally go to the Task Types page and add the following task types: Online Meeting
, Email
, Call
.
The typical web application has users that can log in and do certain things based on their role. Our RadzenCRM
application is no exception!
Let's enable security and see how this affects the RadzenCRM
database.
CRM
from the Data Source dropdown. This tells Radzen what database to use to persist the users and roles.
Check Auto generate pages for user and role management. The application will start with the Login page. You can login with the test credentials admin/admin
(available only during development).
When this happens the application will add a few more tables to the RadzenCRM
database (all starting with Asp
).
The final step is to create a foreign key relationship between the Opportunities
table and the AspNetUsers
table. We need this to associate users with opportunities in our CRM application.
This step is done in SQL Management Studio and your favorite code editor (Visual Studio Code, Visual Studio Professional or anything else really).
Open SQL Management Studio
Add a foreign key between the Opportunities and AspNetUsers table (Opportunities.UserID -> AspNetUsers.Id). You can run this SQL script:
USE [RadzenCRM]
GO
ALTER TABLE [dbo].[Opportunities] WITH CHECK
ADD CONSTRAINT [FK_Opportunities_AspNetUsers] FOREIGN KEY([UserId])
REFERENCES [dbo].[AspNetUsers] ([Id])
GO
ALTER TABLE [dbo].[Opportunities] CHECK CONSTRAINT [FK_Opportunities_AspNetUsers]
GO
Open server\project.csproj
with Visual Studio (or the server
directory with Visual Studio Code).
Add a new file server\Models\CRM\Opportunity.Custom.cs
with the following content.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RadzenCrm.Models.Crm
{
public partial class Opportunity
{
[ForeignKey("UserId")]
public ApplicationUser User { get; set; }
}
}
This extends the Opportunity model (a class which represents a record from the Opportunities table) with a new property User
- the CRM application user it is related to.
Here is how the RadzenCRM
database should look like after the last modification.
You are now ready to proceed to Customize security.
Radzen is free to use. You can also test the premium features for 15 days.
Download NowSelect theme: