Support Portal ContactGet in touch

New Records in CRM with Pre-Populated Values

   Words by CRM Consultancy

   on 07/04/2016 11:36:23

As Dynamics CRM is a web-based application, we can open various screens by simply providing a URL Link – so we might provide a Salesperson with a quick link to open a new Opportunity Record via the following:

https://mycrm.crmcs.co.uk/main.aspx?etn=opportunity&pagetype=entityrecord

Opening this link will then directly browse into the New Opportunity Form which can be a handy time-saving technique as we could then embed this link into an Intranet or Dashboard to make CRM quicker (and so easier) to use for the end user.

image

However the real strength of this is the ability to not only open the Opportunity but provide a URL Link which pre-populates certain Fields on the Form.

So we might provide a Link that creates a New Opportunity pre-populated to a particular Customer and/or Opportunity Type.

We can do this adding an additional element to the URL for ‘extraqs’ – so if looked at a basic example of pre-populating the Name of the Opportunity:

https://mycrm.crmcs.co.uk/main.aspx?etn=opportunity&pagetype=entityrecord&extraqs=name%3DMyOpportunity

This will then prepopulate the ‘name’ field with ‘My Opportunity’.

We can then extend this to include multiple parameters using the same %3D Request String format, alongside separating %26 to separate out the parameters

https://mycrm.crmcs.co.uk/main.aspx?etn=opportunity&pagetype=entityrecord&extraqs=name%3DMyOpportunity%26description%3DExampleDescription

image

Obviously the difficult part here is the %3d and %26 ‘tagging’ characters to handle breaks in our Parameters – these are corresponding to the & and = characters within the ‘extraqs’ parameter itself, but make for a difficult URL when it comes to try to human-read what is going on.

This is using HTML Encoding to handle the ‘extraqs’ parameter as a part within the wider Request String.  The following link gives more context on this ability to Encode a URL using this % notation as way of handling non-standard characters without confusing the Web Browser:

https://www.w3schools.com/tags/ref_urlencode.asp 

Obviously this concept of % characters to replace certain characters does not lead itself to typing up human readable URLs, and so to try and make life easier for ourselves, we can look at using a Spreadsheet Excel Formula to build this link for us:

image

This can then use the SUBSTITUTE Excel Formula to encode our Name/Value Parameters into the right encoding for the URL.

We this freedom, we can look at adding various parameters for our URL and look at how we can add Lookup, Option Set and Custom fields to our URL.

For Option Sets and Custom Fields, this is quite simple as these follow the same format.

For Lookups however, we need to supply the other 2 elements that CRM tracks for each Lookup: the .Name and .Type attributes of the Lookup alongside the code .Id.

So we need to pass our request as lookupid={xxx-xxx-xxx}&lookupidname=RecordName&lookupidtype=RecordType which adds some complexity when working with Lookup fields – however we can work this complexity into our Excel Formula to limit our thinking-time here:

image

Which then results in passing a more complex set of starting values to our New Opportunity:

image

Now we have this URL, we can embed this within an Email or Web Page to provide a better User Experience for the End User in potentially giving them a quick link to create a Gap-Fill Opportunity for a particular Customer or with a particular set of starting values.

This is great for a quick static URL, however if we took this principle into a more Web Application point-of-view then we could look at how our Application Code could potentially generate this URL on the fly to give various dynamics URLs at run time for the Entity and Attributes we want – essentially replacing the Spreadsheet here with our own code-behind logic.

The advantage we have here is that we can use a method in the core .NET Framework to handle the URL Encode for us, instead of relying on an Excel Formula.

// build our string of useful parameters

string parameterString = "name=New Business Opportunity&";

parameterString += "description=Please chase this opportunity and update your notes accordigly&";

parameterString += "new_businesstype=267040002&";

parameterString += "customerid={81403A53-6D8C-E511-80BC-00155D05198A}&customeridname=Land and New Homes&customeridtype=account";

// build the end-url

string urlOpenNewFormInCRM = @"https://mycrm.crmcs.co.uk/main.aspx?etn=opportunity&pagetype=entityrecord&extraqs=" + Server.UrlEncode(parameterString);

// build hyperlink and add into the page

HyperLink linkOpenNewFormInCRM = new HyperLink();

linkOpenNewFormInCRM.NavigateUrl = urlOpenNewFormInCRM;

This gives a more Development-heavy method of achieving the same result as our Formula-based Spreadsheet, which can be handy if developing a custom link to embed in a Webpage, Dashboard or Email.

This ability to provide CRM URL Links that open particular Forms can very useful to tailor the End User Experience and so is embedded throughout CRM – not just for Entity Forms, but also for Advanced Finds, Views and even allowing entirely different Forms to be opened for an Entity Form. (so we could have a link to open Form Type A for a Record, and a separate link to open Form Type B for a record)

The following article from Microsoft’s MSDN expands on this concept and gives the finer detail on how these URL Links work within Dynamics CRM:

Open Forms, Views, Dialogs and Reports with a URL

https://msdn.microsoft.com/en-gb/library/gg328483.aspx

And we can see this first-hand in CRM, as each Form or Views gives us a button for ‘Email a Link’ which effectively use this functionality to allow Links to certain records to be Emailed through the business using CRM:

image

 

The Spreadsheet URL Generator for this article can be downloaded here for future reference: https://support.crmcs.co.uk/downloads/CRMCS_DynamicsCRM_LinkGenerator.xlsx

Share this Article

Search Articles

Filter Articles

CRM Tech DocMan

Recent Articles

CRMCS Quick Start Guide: How To Produce a Microsoft Teams Live Event Dynamics 365 Marketing: Lead Scoring and Sales Acceptance Designing and Developing Microsoft Power Apps Portals Thank You for Attending CRMCS’ Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Thank You for Attending Our Webinar - Achieving B2B sales excellence with Dynamics 365 & Microsoft Teams Webinar: Discover How CRMCS Have United Dynamics 365, SharePoint and Microsoft Teams To Create Sales Excellence Ignite your workflow by adding DocDrive365 to Office 365 The CRMCS guide to everything you need to know about integrating Teams with Dynamics 365 Saving Time By Keeping Documents In One Place TDE Database Encryption with On Premise Dynamics The Key to Successful Compliance in 2020 Part 2: Let’s get GDPR Compliant with Microsoft Power Automate Top 3 Essential Tips for Remote Working Dynamics 365 Marketing: Top 5 Best Features Dynamics Day in the Life - Puma Investments Can you use Teams to amplify collaboration in Dynamics? Part 1: Using a Scheduled Power Automate to Trigger Expiry Date Reminders The secrets of successful document collaboration in Dynamics CRMCS launches new AppSource approved DocDrive365 Dynamics Day in the Life - Moneypenny Release Management Add the App to Dynamics DocDrive365 Security: Day One - Getting Started with Dynamics to SharePoint Permissions Building a New Scheduled Process using Flow
  • "Paul has made a real difference to how my team of 24 people record and store valuable customer data and sales opportunities. Highly recommended."

    James, Operations Director

  • "Understanding your business allows us to advise when to implement aspects of CRM and, likewise, when not to."

    Paul McQuillan, Managing Director

  • "Dynamics 365 and CRMCS have made a real lasting difference to our business, allowing us to replace older systems that were holding back our performance."

    Grahame, Chief Operating Officer

  • "James worked well with us to help connect CRM with Outlook and relate how this might benefit our team using CRM for Property Care."

    Natalie, Property Care Supervisor

  • "Matt was really good with helping us run User Testing on the new Compliance Module of our CRM System."

    Tom, Compliance Administrator

Prefer to go old-school?

Write to us using the below addresses.

Head Office
CRM Consultancy
61 Oxford Street
Manchester
M1 6EQ

London Office
CRM Consultancy London
Grosvenor Avenue
London

Content © CRM Consultancy.