According to Wikipedia, a CRM is a Customer Relationship Management approach to managing a company’s interaction(s) with current and potential customers.
Although there are several dominant players in the CRM space today offering full-blown products for managing these interactions, I was recently asked to come up with a CRM Light version using current tools and provisioning capabilities in SharePoint Online and Office 365. After all, why not use the tools already available to you instead of purchasing another? Now that I’ve seen this entire solution built end-to-end, I’m confident it would suffice for many organizations’ CRM needs.
Credit: The approach to this solution was based on a session given by Drew Madelung and Vlad Catrinescu at the Microsoft Ignite 2018 session titled: From start to finish: How to create your modern SharePoint site provisioning solution
This is part 2 of a 3-part blog post series with steps to build one.
In part 1, we designed the site and information architecture and determined the overall process for the solution. Now it’s time to build the components!
- Part 1: CRM Light in Modern SharePoint. The Design.
- Part 2: CRM Light in Modern SharePoint. The Build. (this post)
- Part 3: CRM Light in Modern SharePoint. The Execution.
- Build the Site Script (JSON file) for the Customer site
- Add the Site Design to invoke the Site Script
- Build the Azure Job to run the PowerShell
- Build the Microsoft Flow to invoke the Azure Automation Job
Step 1: Build the Site Script
For each Customer site, a Modern Team site with a Group will be provisioned which means it will automatically get a Document library, Pages library, Events calendar, OneNote notebook, and Planner. This will provide a collaboration space for all work relating to a customer.
In addition to this, I want to do the following:
- To manage contacts, provision a Contacts list with out-of-the-box metadata: Name, Email Address, Mobile #, Job Title, Address, etc.
- Add above Contacts list to the quick launch navigation
- Remove Pages and Site Contents from the quick launch navigation
- Join the newly provisioned Customer site to the Customer Hub
- Many more things could be done here as well… this post is defining the structure to start with. Other lists and worklows could be added to address additional requirements you may have for a CRM. For example: campaign tracking, sales tracking.
Save it locally and add it to a Customer Site Design (next step).
Step 2: Add the Site Design
Since we want to create a group-connected Team site for each of the Customer sites, we’ll add our Site Design to Web Template 64 and include the Site Script from above:
Once the Site Design is added for Customer Site, reference it in the Azure Job (next step).
Step 3: Build the Azure Job
The Azure job will do these things:
- Use PnP PowerShell to create a Modern Team site with a Group
- Invoke the Site Design by its Title (Customer Site) to apply to the site once provisioned
- Add the Customer Account Rep to the Members and Owners Groups
- Update the Customer Hub’s top navigation to include the new site under its industry vertical
To do this, set up a PowerShell Runbook in an Azure Automation account. If you don’t have one set up, here is a post explaining the steps to do this: Run PowerShell on SharePoint from Azure Automation.
You’ll also need to add 2 modules from the Modules gallery:
- SharePoint PnP module for SharePoint Online (SharePointPnPPowerShellOnline)
- Exchange Online Shell module to work with Office 365 Groups (ExchangeOnlineShell)
For the PowerShell, I used the Ignite 2018 script reference from Vlad Catrinescu and Drew Madelung as reference and tweaked it for my Customer site example. I changed the script to only provision Customer Sites, however it’s a great idea to expand on the script to accomodate many other site templates (as Vlad and Drew have done).
Customer site PowerShell: Azure Automation PowerShell for Customer Site
Test the Runbook with sample data to ensure the Customer Site is being provisioned correctly. Once the test is successful, invoke the Runbook from Microsoft Flow (next step).
Step 4: Build the Microsoft Flow
The Flow is triggered by a new/changed item in the Customer Details SharePoint list.
An important aspect of the Flow is ensuring the Customer site URL name we’re providing to the Azure Runbook is a valid URL. Please refer to a recent post by Vlad Catrinescu to build a “URL-friendly” string: How to convert string to URL friendly string with Microsoft Flow. I used that expression to apply to the Customer Name the end-user added to the SharePoint list. After all, you never know what an end-user will enter! 🙂
Details for each step:
- Step 1: triggered on a new/changed item in Customer Details list
- Step 2: build a url-friendly Customer site URL (Reference)
- Step 3: check if the Customer Status is ‘Current’ and the Site Request Status is ‘Pending’. This is what will trigger creation of a new Customer site. (Advanced expression below)
- Step 4: invoke Azure job (use the Create Job action in Microsoft Flow to call the Azure Runbook)
- Step 5: Update Customer Details item with URL and provisioning status (this step needs the ‘Send an HTTP request’ action rather than just calling an ‘Update item’ because we want to give the Customer Site link a friendly name, something not possible with the ‘Update item’ action. Refer to another post of mine where I describe this technique: Microsoft Flow: Update SharePoint columns)
What’s next? Proceed to the next post to see how this all comes together in the Execute phase!