MS Dynamics CRM and CPQ integration


This page provides you with instructions how to successfully integrate your MS Dynamics CRM with CPQ.

Prerequisite: Federated SSO needs to be set up for the integration to work properly. The following steps need to be taken in order to establish SSO between SAP CPQ and Microsoft Dynamics CRM:

  • SAML metadata files exchange between IdP and SP side. ADFS or Azure AD is the identity provider (IdP) on the customer side and SAP CPQ is the service provider (SP).
  • User mapping should be configured on ADFS side and SAP CPQ side.

When SSO is configured, a CRM user will automatically be mapped to a SAP CPQ user after landing from CRM to SAP CPQ and there won't be any need to send the ID of the CRM user in the URL of the SAP CPQ landing page.


CRM Setup


To start administering MS CRM, you need to have an administrative account. Log in using administrative credentials and then go to Settings and click Customizations (See Figure 1)

Figure 1 - Settings/Customization


On the next screen, click Customize the System (See Figure 2)

Figure 2 - Customize the System


A list of components is displayed. The first step is to create a new entity called CPQ_Quote.


Step 1: Create CPQ_Quote entity


Among components from the left pane, select Entities and click New (See Figure 3).

Figure 3 - Adding new Entity


This brings screen with the form to define Entity. Fill the form as depicted in Figure 4 and instructed below.

Figure 4 - Customize the entity CPQ Quote


Field nameField valueNote
Display NameCPQ Quote
Plural NameCPQ Quotes
Namenew_cpqquoteThis field is auto-populated
Areas that display this entitySales


Click Save and navigate to Fields item under the CPQ Quote entity menu in the left pane (See Figure 5)

Figure 5 - Fields of CPQ Quote entity


This brings screen where you should add fields that are required for the integration as depicted in Figure 6 or instructed below.

Display NameData TypeField TypeFormatMaximum LengthIME ModeTarget Record Type
CPQ QuotePrimary Key
NameSingle Line of TextSimpleText100auto
OpportunityLookupOpportunity
Link To QuoteSingle Line of TextSimpleText100auto


Figure 6 - Adding required fields


Step 2: Customize Opportunity form


The next step is to customize the Opportunity form the way it displays the list of related CPQ Quotes. To do so, select Opportunity from list of entities and click Forms (in the left pane). From the list of active forms that are displayed in the right pane, click form named Opportunity to edit it. Note that you should edit the Opportunity form that has type Main, not the form that has type Quick Create. (See Figure 7).

Figure 7 - Select form to edit


Form for adding new tab is displayed (See Figure 8).

Figure 8 - Adding new tab



Click on INSERT tab at the top menu, then click on One Column. New tab is created with its default name “Tab”.
Double click on “Tab” label to open Tab Properties dialog box. Here you can change label from its default value - “Tab” to “Opportunity Quotes”, (See Figure 9)

Figure 9 - Change Tab’s label



Fill out form fields Name and Label, and click OK.
Locate your renamed tab “Opportunity Quotes” and point mouse cursor over the section inside the tab, then click on Sub-Grid menu item from main menu at the top of the page (See Figure 10).

Figure 10 - Add quotes sub-grid



Sub-Grid properties window is displayed. Fill out form fields as depicted in Figure 11 and described below.

Field nameField valueNote
NameCPQ Quotes
RecordsOnly Related Records
EntityCPQ Quotes (Opportunity)
LabelCPQ Quotes (Opportunity)This field is auto-populated, when you select Entity


Figure 11 - Set properties of Sub-Grid



Leave the rest of the options as they are, then save the form and publish customizations. You are done with customizing the Opportunity form to display CPQ Quotes. In the next step, you will create action that will be used to create new CPQ Quotes.

Step 3: New CPQ Quote


In this section, we will describe the procedure to create a button that will be used to authorize the MS Dynamics user to open CPQ catalog, browse it and add product(s) to the CPQ Quote. This quote will be connected to your MS Dynamics Opportunity you are currently working on.
1. Go to SettingsCustomizationsCustomize the System (See Figure 1 at the top of this page).

2. Locate the Opportunity entity at the left pane, then click on Forms submenu, then click on Opportunity (Main) form to edit it (See Figure 12).

Figure 12 - Edit Opportunity form


3. New page for editing the form is displayed. Locate the Opportunity Quotes area and click on to activate it, then click on tab INSERT at the top menu, and finally click Web Resource (See Figure 13).

Figure 13 - Adding new web resource


4. “Add Web Resource” dialog box is open. Click on Search icon and then click on Look up More Records (See Figure 14)
\\

Figure 14 - Defining new Web Resource



5. New dialog box - “Look Up Record” is open. Click New (See Figure 15).

Figure 15 - Look Up Record



6. New dialog box for adding new Web Resource is open. Fill out fields as depicted in Figure 16 and instructed below.

Figure 16 - Adding new Web Resource



Field nameField valueNote
NameCreateCpqQuotenew_ is prepended automatically
Display name Create CPQ Quote
TypeWebpage (HTML)



Click Text Editor button to open text editor. Click on Source tab to open it. Copy and paste code provided below the Figure 17 and then click OK (See Figure 17).

Figure 17 - Paste code



<html><head>
    <title>Create CPQ Quote</title>
    <meta>
    <script type="text/javascript">
        function NewQuote() {
            var entity = window.parent.Xrm.Page.data.entity;
            var id = entity.getId();
            var name = entity.attributes.get("name").getValue();
            var extraqs = "new_opportunity=" + id + "&new_opportunityname=" + name;            
            window.top.location.href = "https://calliduscloud600.crm.dynamics.com/main.aspx?etn=new_cpqquote&pagetype=entityrecord&extraqs=" + encodeURIComponent(extraqs);
        }
    </script>
<meta><meta></head>
<body style="word-wrap: break-word;">
    <input type="button" value="Create CPQ Quote" onclick="NewQuote();">
</body></html>



Web Resource details are displayed in the dialog box (See Figure 18).


Figure 18 - Web Resource details



You are done with creating Web Resource. Click OK. Web Resource appears in Opportunity Quotes section (See Figure 19).

Figure 19 - New Web Resource is displayed



Save Opportunity form, Publish customizations and refresh Opportunity page.

Step 4: Customize CPQ Quote form


Now, we are going to edit CPQ Quote form in order to display CPQ Catalog. To do so, follow next steps.

1. Go to SettingsCustomizationsCustomize the System (See Figure 1 at the top of this page). 2. Locate the CPQ Quote entity at the left pane, then click on Forms submenu, then click on Information (Main) form to edit it (See Figure 20).

Figure 20 - Edit CPQ Quote form



3. Click on INSERT tab, then select area in section CPQ Quote, click One Column and finally click IFRAME button (See Figure 21).

Figure 21 - Addin an IFRAME



4. Dialog box for adding new Iframe is displayed.

  • Under General tab fill out the required fields as depicted in Figure 22 and instructed below.

Figure 22 - Iframe properties



Field nameField valueNote
NameCPQiframe_ is prepended automatically
URL https://teststable.webcomcpq.com/MsCrm/Login.aspx?opportunityId=value&quoteNumber=value&action=valueopportunityId is the ID of the Opportunity object in CRM. quoteNumber is the composite number of the CPQ quote. Quote composite number can be sent in clear text or masked, using 0xFF XOR mask. action is the quote action. It can take values new, edit or view. new should be used for creating a new quote object. edit should be used for editing an existing quote, and view should be used to access the quote in the read-only mode.
LabelCPQ



  • Under Formatting tab fill out field as depicted in Figure 23 and instructed below.



Figure 23 - Set Number of Rows to be displayed



Field nameField valueNote
Number of Rows35



Save changes.
Now, we must add an event that will dynamically set IFrame URL depending on the action triggered. There are two possible actions - new and edit.

To do so, follow next steps.

1. Go to SettingsCustomizationsCustomize the System (See Figure 1 at the top of this page)

2. Locate the CPQ Quote entity at the left pane, then click on Forms submenu, then click on Information (Main) form to edit it (See Figure 20 above)

3. Under HOME tab click on Form Properties (See Figure 24)

Figure 24 - CPQ Quote Form



“Form Properties” dialog box is displayed (See Figure 25).

Figure 25 - Form Properties



4. Click Add under Form Libraries area as depicted in Figure 25. This opens another dialog box - Web Resource, where you add new Resource (Form Library). To do so, click New (See Figure 26).

Figure 26 - Adding new Resource (Form Library)



This opens a dialog box where you define new Script (JavaScript). Fill out fields as depicted in Figure 27 and instructed below.

Figure 27 - Create new Script



Field nameField valueNote
NameSetUrlForCpqQuotenew_ is prepended automatically
TypeScript (JScript)new_ is prepended automatically



5. Click Text Editor to paste JavaScript code that is provided below into the Script editor. Note that the only thing you should modify in the script is CPQ domain name (See Figure 28).

Figure 28 - Insert Script



function SetUrlForCpqQuote() {
    opp = Xrm.Page.data.entity.attributes.get("new_opportunity").getValue();   
    var userId = Xrm.Page.context.getUserId();
    var oppId = opp[0].id;
    var newquoteurl = "https://sandbox.webcomcpq.com/sso/mscrm.aspx?domain_name=callidus&userId="+userId+"&typename=opportunity&id="+oppId;
    linktoquote = Xrm.Page.data.entity.attributes.get("new_linktoquote").getValue();
    var IFrame = Xrm.Page.ui.controls.get("IFRAME_CPQ");


    if (linktoquote) {
        IFrame.setSrc(linktoquote);
    } else {
        IFrame.setSrc(newquoteurl);
    }
}



Click OK.
6. Now you can add the Form Library you have just created. To do so, while you are in Form Properties dialog box, click Add under Form Library area as depicted in Figure 29, then search for the library and click Add (See Figure 30).

Figure 29 - Add the existing Form Library



Figure 30 - Search for the recently added Form Library



7. Now, add new Event Handler by clicking on Add under Event Handler area, as depicted in Figure 31.

Figure 31 - Adding new Event Handler



This opens a new dialog box - Handler Properties. In this dialog enter name of the function (SetUrlForCpqQuote), as depicted in Figure 32.

Figure 32 - Event Handler Properties



Step 5: Navigating back to Opportunity



You can navigate back to the Opportunity form by clicking on Recently Viewed Items from top navigation bar, but the more convenient way is to click on button. This button must be added as a Web Resource first. Follow next steps to create it.

1. Go to SettingsCustomizationsCustomize the System (See Figure 1 at the top of this page). 2. Locate the CPQ Quote entity at the left pane, then click on Forms submenu, then click on Information (Main) form to edit it (See Figure 33).

Figure 33 - Customize CPQ Quote forms



3. On next screen, navigate to the INSERT tab, then select area in section CPQ Quote, and finally click Web Resource button (See Figure 34).

Figure 34 - Insert Web Resource



4. “Add Web Resource” dialog box is open. Click on Search icon and then click on Look up More Records (See Figure 35).

Figure 35 - Defining new Web Resource



5. New dialog box - “Look Up Record” is open. Click New (See Figure 36).

Figure 36 - Look Up Record



6. New dialog box for adding new Web Resource is open. Fill out fields as depicted in Figure 37 and instructed below.

Figure 37 - Adding new Web Resource



Field nameField valueNote
NameBackToOpportunitynew_ is prepended automatically
Display NameBackToOpportunity
TypeWebpage (HTML)



Click Text Editor button to open text editor. Click on Source tab to open it. Copy and paste code provided below the Figure 38 and then click OK (See Figure 38).

Figure 38 - Code to define Back to Opportunity button



<html><head>
    <title>Back to Opportunity</title>
    <meta>
    <script type="text/javascript">
        function BackToOpportunity() {
            var opp = window.parent.Xrm.Page.data.entity.attributes.get("new_opportunity").getValue();
            var oppId = opp[0].id;
            window.top.location.href = "https://calliduscloud600.crm.dynamics.com/main.aspx?etn=opportunity&pagetype=entityrecord&id=" + oppId;
        }
    </script>
    <meta>
<meta></head>
<body style="word-wrap: break-word;">
    <input type="button" value="Back to Opportunity" onclick="BackToOpportunity();">
</body></html>



Web Resource details are displayed in the dialog box (See Figure 39).

Figure 39 - Web Resource details



You are done with creating Web Resource. Click OK. Web Resource appears in Opportunity Quotes section (See Figure 40).

Figure 40 - New Web Resource is displayed



Save CPQ Quote form and publish customizations.

CPQ Setup


Step 1: Define general parameters



Beside CRM, you must do some setup steps on CPQ side too. This portion of text describes in detail what you should set in order to make your CRM - CPQ integration operable.

Log into your CPQ domain and go to SetupCRM IntegrationGeneral. Under ”CPQ is integrated with” drop-down list choose “Microsoft CRM”.

Under CRM Webservice Discovery URL enter:

For CRM Online customers:



For CRM On-premise customers:


Under “Your company name in CRM”, enter your company name.
Under “Domain name (enter if using Active Directory)”, enter your domain name only if you are using Active Directory.
Under “Organization URI enter: https://{YourCompanyName}.crm.dynamics.com/XRMServices/2011/Organization.svc
Under “Endpoint type” enter LiveId

Figure - CRM integration parameters

Step 2: Define an administrative account


Now you must define an administrative account. To do so, follow next steps.

  • Go to Setup > CRM Integration > CRM Administrator Account
  • Click Add New to create a new administrator account


In the displayed form, choose Microsoft CRM under CRM Name, then fill out other fields based on your data and needs and click Save (See Figure 41)

Figure 41 - Adding administrative account

Step 3: Define custom actions



New custom actions should be defined to provide a way to update opportunity in CRM through CPQ, and to move the opportunity from one stage to another. Custom actions are programmed using Iron Python. Follow next steps to add new custom action.

  • Go to Setup > Develop > Custom Actions
  • Click Add New fill out the form with necessary data (action name, action image, placement…)



A list of custom actions, developed using Iron Python, can be found on this link: Custom Actions.

Step 4: Set Workflow and Workflow permission



The last step is dependent on your model and it assumes that you must set Workflow permission for users or user types as desired, and set Workflow transitions. To find more details on how to do this, check this link: Workflow Permissions

You are here: SAP Sales Cloud CPQ Online HelpAdmin Page HelpIntegrationsMS DynamicsMS Dynamics CRM and CPQ integration