Managed Package Deployment via MS D365 CE

Last updated:

This process allows you to install Pendo on top of Microsoft Dynamics. However, Pendo recommends adding Microsoft Dynamics as an extension application in the Subscription tab and then accessing Pendo through the Pendo Launcher.

Pendo Installs on MS Dynamics 365 Customer Experience v9.1 and higher using a Managed or an Unmanaged Package. Once installed, metadata and targeted users can be identified using the instructions below.

Installing the Dynamics 365 Package in MS D365 CE 

1. Navigate to the Solutions section of your MS D365 CE settings. 

The Classic UI is shown below:  

mceclip1.png

2. Click on the Gear Icon (1) and Advanced Settings, then Settings > Solutions.

The Modern UI is shown below:

mceclip2.png

3. Select Import and import the provided Pendo Package into MS D365 CE.

The Classic UI is shown below:

Screen_Shot_2021-11-19_at_1.10.40_PM.png

The Modern UI is shown below:

Screen_Shot_2021-11-19_at_1.11.24_PM.png

4. Open the Pendo Package and edit the callPendoAPI Web Resource.

Screen_Shot_2021-11-19_at_1.12.07_PM.png

5. Click on the Text Editor.

mceclip3.png

6. Copy and paste the Pendo API Key into the location indicated below. You can find your API key in Settings > Subscription.

function callpendoapi() {

    'use strict';

    if (window.top.pendo) return;

    console.log('Invoking Pendo Agent');

    let agentUrl = "https://cdn.pendo.io/agent/static/<YOUR PENDO API KEY HERE>/pendo.js";

    pendo(agentUrl);

    return false;

}

function pendo(agentUrl) {

    'use strict';

    (function (p, e, n, d, o) {

        var v, w, x, y, z; o = p[d] = p[d] || {}; o._q = [];

        v = ['initialize', 'identify', 'updateOptions', 'pageLoad']; for (w = 0, x = v.length; w < x; ++w) (function (m) {

            o[m] = o[m] || function () { o._q[m === v[0] ? 'unshift' : 'push']([m].concat([].slice.call(arguments, 0))); };

        })(v[w]);

        y = e.createElement(n); y.async = !0; y.src = agentUrl;

        z = e.getElementsByTagName(n)[0]; z.parentNode.insertBefore(y, z);

    })(window.top, window.top.document, 'script', 'pendo');

    window.top.pendo.initialize({

        visitor: {

            id: //Globally Unique Visitor ID 

            // email:        // Recommended if using Pendo Feedback, or NPS Email

            // full_name:    // Recommended if using Pendo Feedback

            // role:         // Optional

            // You can add any additional visitor level key-values here,

            // as long as it's not one of the above reserved names.

        },

        account: {

            id: //Name Of Organization Or Department Visitor Belongs To

            // is_paying:    // Recommended if using Pendo Feedback

            // monthly_value:// Recommended if using Pendo Feedback

            // planLevel:    // Optional

            // planPrice:    // Optional

            // creationDate: // Optional

            // You can add any additional account level key-values here,

            // as long as it's not one of the above reserved names.

        }

    });

}

OPTIONAL: Selectively call Pendo based on the Dynamics 365 Application

If you would like to selectively call Pendo on some, but not all, MS D365 CE applications, replace the callPendoAPI Function using the sample code below as a basis for your changes.

function callpendoapi() {

    'use strict';

    if (window.top.pendo) return;

    var globalContext = Xrm.Utility.getGlobalContext();

    globalContext.getCurrentAppProperties().then(

        function success(app) {

            console.log(app);

            // select which app will have Pendo running

            if (app.uniqueName === '<YOUR UNIQUE MSD365 APP NAME HERE>'){

               // Load Pendo if unique name matches

               console.log('Invoking Pendo Agent on ' + app.uniqueName);

               let agentUrl = "https://cdn.pendo.io/agent/static/<YOUR PENDO API KEY HERE>/pendo.js";

               pendo(agentUrl);

            }

           else if (app.appId === '<YOUR UNIQUE MSD365 APP ID HERE>'){

               // Load Pendo if unique ID matches

               console.log('Invoking Pendo Agent on ' + app.appId);

               let agentUrl = "https://cdn.pendo.io/agent/static/<YOUR PENDO API KEY HERE>/pendo.js";

               pendo(agentUrl);

            }
}

The Unique ID and Unique Name for your MS D365 CE App can be found as shown below.

1. Click your app name at the top to view all available apps.

mceclip4.png

2. Click the three dots in your App tile and select “Open In App Designer”.

mceclip5.png

 

3. Click Properties to view the Unique Name.

mceclip6.png


The Unique ID can be found in your URL.  Look for “appid=” and the characters between the “=” and the “&” is your Unique ID.

mceclip7.png

The Unique ID and Unique Name for your MS D365 CE App can be found by using the following console command:

Xrm.Utility.getGlobalContext().getCurrentAppProperties()

mceclip8.png

Configuring Metadata 

Follow the instructions above to edit the call PendoAPI function:

Once you can edit the function look for the Visitor and Account arrays.  Visitor ID is a required field and must be globally unique.  Account ID is highly recommended and can be the department or organization.  Review our support documentation for guidelines and suggestions for Visitor and Account IDs and other metadata.

function callpendoapi() {

    'use strict';

    if (window.top.pendo) return;

    console.log('Invoking Pendo Agent');

    let agentUrl = "https://cdn.pendo.io/agent/static/<YOUR PENDO API KEY HERE>/pendo.js";

    pendo(agentUrl);

    return false;

}

function pendo(agentUrl) {

    'use strict';

    (function (p, e, n, d, o) {

        var v, w, x, y, z; o = p[d] = p[d] || {}; o._q = [];

        v = ['initialize', 'identify', 'updateOptions', 'pageLoad']; for (w = 0, x = v.length; w < x; ++w) (function (m) {

            o[m] = o[m] || function () { o._q[m === v[0] ? 'unshift' : 'push']([m].concat([].slice.call(arguments, 0))); };

        })(v[w]);

        y = e.createElement(n); y.async = !0; y.src = agentUrl;

        z = e.getElementsByTagName(n)[0]; z.parentNode.insertBefore(y, z);

    })(window.top, window.top.document, 'script', 'pendo');

    window.top.pendo.initialize({

        visitor: {

            id: //Globally Unique Visitor ID 

            // email:        // Recommended if using Pendo Feedback, or NPS Email

            // full_name:    // Recommended if using Pendo Feedback

            // role:         // Optional

            // You can add any additional visitor level key-values here,

            // as long as it's not one of the above reserved names.

        },

        account: {

            id: //Name Of Organization Or Department Visitor Belongs To

            // is_paying:    // Recommended if using Pendo Feedback

            // monthly_value:// Recommended if using Pendo Feedback

            // planLevel:    // Optional

            // planPrice:    // Optional

            // creationDate: // Optional

            // You can add any additional account level key-values here,

            // as long as it's not one of the above reserved names.

        }

    });

}

Visitor Metadata suggestions can be found here. An example is found below:

        visitor: {

            id: Xrm.Utility.getGlobalContext().userSettings.userId,

        },

Account Metadata suggestions can be found here. An example is found below:

        account: {

            id: Xrm.Utility.getGlobalContext().organizationSettings.organizationId,

        }

Publish the Pendo Solution once you have saved your metadata fields.

mceclip9.png

Verifying Pendo is Installed

You can verify Pendo is running by following the instructions here.  You may need to log out and log back into your instance of MSD365 to allow Pendo to initialize.