Sample: Create and associate knowledge base record to incident


Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

This sample demonstrates how to create a knowledge base record instance, and associate it with an Incident instance. For more information about the feature that this sample demonstrates, see Use Parature knowledge in Dynamics 365.

This sample is for Microsoft Dynamics CRM Online 2015 Update 1 and Microsoft Dynamics 365 (on-premises) . This is available to download from Parature Integration: Create and associate knowledge base record to incident.


  1. Have access to a Microsoft Dynamics CRM Online 2015 Update 1 or Microsoft Dynamics 365 organization, and Parature knowledge management integration must be enabled for the Dynamics 365 organization. More information: TechNet: Connect Microsoft Dynamics CRM to Parature knowledge base.

  2. Download the ParatureIntegration Visual Studio project.

  3. Open the ParatureIntegration Visual Studio project and install Microsoft.CrmSdk.CoreAssemblies version 7.1.0-preview NuGet Package. See Install NuGet packages later for instructions.

    After you install the NuGet packages, see Run the sample for instructions on how to run the sample and what to expect.

In This Topic

What this sample does

Install NuGet packages

Run the sample

What this sample does

  1. The CreateandAssociateKBRecordtoIncident class Run method calls the CheckCRMVersion method, which detects if you are running the appropriate version of Dynamics 365 for the sample.

  2. The CheckKnowledgeManagementStatus method checks if the knowledge management is enabled for the Incident entity.

  3. The CreateRequiredRecords method creates the required records for the sample: a sample account and an incident record.

  4. Creates a sample KnowledgeBaseRecord record.

  5. Associates the sample KnowledgeBaseRecord record with the Incident record created earlier, checks if the association is successful, and then disassociates the records.

  6. Finally, the DeleteRequiredRecords method prompts you to delete the entity records created during the sample run:

    1. Type y, and press ENTER to delete the entity records from your organization.

    2. Type n, and press ENTER to leave the entity records in your organization. You will have to manually delete the entity records later if you want to return to the original state.

Install NuGet packages

Use the following steps to install the required assemblies for this sample:

  1. Download this sample and extract the files.

  2. Navigate to the C# folder and open the ParatureIntegration.sln file using Visual Studio.

  3. In Visual Studio, right-click the ParatureIntegration project and chose Manage NuGet Packages.

  4. For the preview release, make sure to select Include Prerelease rather than Stable Only in the search criteria. Then search for “Microsoft Dynamics CRM 2015 SDK core assemblies”. Make sure you select the 7.1.0-preview version.

  5. Click Install. You’ll need to accept the license terms to complete installing this package.

Run the sample

  1. In Visual Studio, with the solution open and the necessary NuGet packages installed, press F5.

  2. If you have not previously run one of the Microsoft Dynamics 365 managed code samples before, you’ll need to enter information to run the code, otherwise enter the number for one of the Dynamics 365 servers you have previously set up.



    Enter a Dynamics 365 server name and port []

    Type the name of your Microsoft Dynamics 365 server. The default is Microsoft Dynamics 365 (online) ( in North America.


    Is this organization provisioned in Microsoft online services (y/n) [n]

    Type y if this is a Microsoft online services provisioned organization. Otherwise, type n.

    Enter domain\username

    Type your Microsoft account.

    Enter password

    Type your password. The characters will show as “*” in the window. Your password is securely saved in the Microsoft Credential Manager for later reuse.

    Specify an organization number (1-n) [1]

    From the list of organizations shown that you belong to, type the corresponding number. The default is 1, indicating the first organization in the list.

  3. The sample will perform the operations described in What this sample does and may prompt you with additional options.

  4. When the sample is complete, press ENTER to close the console window.

See Also

Use Parature knowledge in Dynamics 365

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright