Solution history in Dynamics 365 – Audit of Solution

“Sometimes history repeats itself. And sometimes it doesn’t.” – Adam Curtis

I agree with Adam about history thought. We can’t predict that history will repeat or will not. Somewhat same thing we can see in latest version of CRM as well. In previous version of Dynamics CRM, it was very critical job to identify audit history of solutions such as type of operation performed (imported, exported or uninstalled), total time required to perform the operation, etc.

With the help of solution history, we can keep track of both the solutions, unmanaged as well as managed solution. Now let see step by step how we can configure solution history in MS Dynamics CRM (customer engagement)

1. Navigate to Settings -> Customization and click on “Solution History”.

1.jpg

2. Select the view provided by CRM from the list. Here is the place where you can see solution history records.

2

3. Open the solution history record. Here you will be able to see following details of solution:

  • Solution Name
  • Solution version
  • Publisher Name
  • Sub operation
  • Operation Name (Import, export or uninstall)
  • Managed (Denotes type of solution whether it is managed or not)
  • Start Time – Denotes time of operation on solution started.
  • End Time – Denotes time of operation on solution completed.
  • Total Time (Seconds) – Time required to complete the operation.
  • Result – Success/Failed.

3

If you have noticed here, record is in read only mode. Even system administrator also can’t edit or clear the solution history since it is in read only format because we don’t have any option to provide the access of apart from “read”, “append” and “append to” inside security role.

4

 

In case if you want to read all columns of solution you can use “advance find” to search the solution history data. Also, for reporting purpose you can download the solution history records using “Export solution history” button on top of the advance find window.

5

Hope this help you 👍

Change X axis and Y axis labels in CRM chart

Working as CRM consultant I found dashboard as mostly useful tool to visualize data in list as well as in chart format. Using list, we can show number of records in grid whereas using chart we can show data in bar, pie, line etc format.

Recently one of my colleague asked me to explore chart in details with custom properties. In this blog I will explore about data labels in chart. Let see how we can change labels of X and Y axis in chart.

Steps:

1. Navigate to the dashboard on which you have to update chart.

In my case, I’m using Marketing dashboard and want to change the labels of X and Y axis of campaign budget vs actual costs (by month)

Click on middle button icon available on top right corner of chart as shown in below snapshot.

1

Here I have selected x axis as Month (Actual end date) field of campaign.

2. Inside new popup template window, click on ‘Action’ button and select “Export Chart”.

Save file with extension as .xml

2

3. Open downloaded file in Visual studio or Notepad ++ and search for keyword ‘ChartAreas’

This is the place where we can define our own properties for Axis ‘X’ and Axis ‘Y’. In my case I have added here Title of ‘X’ axis as “Month” whereas “Campaign Budget” as axis ‘Y’

Title X = “Month”

Title Y = “Campaign Budget”

3

4. Finally you can import chart in crm as shown in below snapshot. There is one options available while importing chart to create chart with new name or also you can update same chart as well.

4

Once you click on import button changes will reflect in chart.

5

There are couples of properties available for ChartAreas that you can use to modify OOB chart such as TitleForeColor, TitleFont etc to visualize data for different user experience.

Cheers with this feature and define your own variety of designs in chart rather than creating SSRS report.

Pratibha, I appreciate your thought, assistance and input….

Hope this help you 😊

Open in Excel Online – MS Dynamics 365 excel online

Editing and importing records is much easier task in MS CRM for users. In case of bulk edit of records, we can use data import functionality.

 

Let us see step by step how we can use new feature of Dynamics CRM that help us to import as well as create data using ‘Open in Excel Online’ feature.

1. Navigate to module of CRM (such as Sales, service) -> Entity

2. Select view from the list that you need to update record. Select Export to Excel fly out on ribbon button and click on ‘Open in Excel Online’

1

3. It will redirect to excel application online with view data. Here is the place where you can bulk update or create records directly in CRM.

Once you done with changes click on “Save Changes to Dynamics 365” button to submit data.

2.png

4. After submitting data alert message will trigger with data submitted notification. Click on close button on popup window.

3

Once click on refresh list icon to reflect new values in entity view. Finally, you can see updated data in CRM view.

 

This feature is useful in below situations:

A. In case if you want to update read only records without reopening it.

For ex. If you want to update Inactive accounts without reactivating it.

B. If you want to update records in bulk.

C. Any crm user can easily use this feature in CRM online to edit/update data.

D. Any particular view can update with sequence value

For ex. Auto number sequence.

Hope this help you 😊

Hide ribbon button on view (Home grid) if one or more records selected in view

Recently I had one requirement to hide “Run Report” on home page button if one or more records selected in view list.

Magic becomes art when it has nothing to hide. – Ben Okri

Same way I found one magic in CRM using OOB functionality to show button if nothing selected and hide if at least one selected in home grid.

 

Let see step by step how I did this:

1. Create Javascript web resource and add below code in it.

///==========================================================================

/// Description : Hide View Run report button

/// Created By  : PRAVIN

/// Event       : Ribbon button – Enable rule

HideReport = function(selectedIds)

{

    try {

        if (selectedIds.length > 0)

            return false;

        else

            return true;

    }

    catch (error) {

        alert(‘HideReport function error: ‘ + error);

    }

}

///==========================================================================

2. Either download ribbon workbench solution from here https://www.develop1.net/public/rwb/ribbonworkbench.aspx and import into your CRM organization.

Or

Download Xrm Toolbox from here https://www.xrmtoolbox.com/ and connect to your CRM instance. Select ribbon workbench plugin in plugin store and install it.

3. Click on “Ribbon Workbench” and select your solution from the list as shown in below screenshot.

1

4. Select entity name from list available in solution you have selected in ribbon solution at left bottom corner.

5. Inside ribbon workbench tool go to the Home section and scroll horizontally to select button.

6. Select button that you want to hide/show in home page. In my case I have to hide run report button.

7. Right click on button and select customize command button.

2

8. Now customized command will be visible in solution element. Select command “Mscrm.ReportMenu.Grid” and add Enable Rule inside properties command.

 

9. Type Id of button Id text. Click on Add Step and select ‘CustomRule’ from dropdown list

10. Inside CustomRule select Default value as True and InvertResult as False.

3

11. Type FunctionName and select your web resource in library textbox as shown in above screenshot. Once done with adding rule into command click on publish.

12. To get count of selected records click on “Add Parameter” and select CRM Parameter from the list. Select ‘SelectedControlAllItemIds’ as parameter.

5

13. After publishing solution, refresh CRM window once and navigate to view of entity.

You will be able to see “Run Report” if none of record selected in view. Vice versa if you select one or more than record in view button will be hidden.

4

This magic works fine in entity associated sub grid as well.

Hope this helps you 😊

Retrieve option-set values and labels without use of metadata request in Plugin and JavaScript

Metadata is the place of database where we can retrieve information about structure of database such as attribute properties, length, max-size etc. In most of the requirement we need to retrieve option set values in java-script as well as plugin.

1. If we use Xrm library to retrieve option-set value, we can get only selected option set value and label.

var OptionValue = Xrm.Page.getAttribute(“logicalnameofattribute”).getValue();

var OptionLabel = Xrm.Page.getAttribute(“logicalnameofattribute”).getText();

 

2. In case of plugin as well we can access only label and value of selected option.

int OptionValue = EntityObject.Attributes.Contains(“logicalnameofattribute”) ? EntityObject.GetAttributeValue<OptionSetValue>(” logicalnameofattribute”).Value : 0;

 

string OptionLabel = EntityObject.FormattedValues.ContainsKey(“logicalnameofattribute”) ? EntityObject.FormattedValues[“logicalnameofattribute”] : null;

 

“Any system is only as good as the metadata that it ingests.”
― Chris Bulock

 

I believe that MS Dynamics CRM is as easier as to retrieve metadata in Javascript and c# as well. Here I will show you how we can retrieve metadata of optionset without use of metadata request.

I will explorer here more with technical example how we can retrieve metadata of optionset using stringmap table.

 

A). Plugin:

Here I’m using fetch expression to retrieve stringmap table of account entity.

string EntityLogicalName = “account”;

string FieldLogicalName = “customertypecode”;

string FetchXml = @”<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’>

<entity name=’stringmap’ >

<attribute name=’attributevalue’ />

<attribute name=’value’ />

<filter type=’and’ >

<condition attribute=’objecttypecodename’ operator=’eq’ value = ‘” + EntityLogicalName + @”‘ />

<condition attribute=’attributename’ operator=’eq’ value = ‘” + FieldLogicalName + @”‘ />

</filter>

</entity>

</fetch>”;

FetchExpression FetchXmlQuery = new FetchExpression(FetchXml);

EntityCollection FetchXmlResult = service.RetrieveMultiple(FetchXmlQuery);

if (FetchXmlResult.Entities.Count > 0)

{

foreach (Entity Stringmap in FetchXmlResult.Entities)

{

string OptionValue = Stringmap.Attributes.Contains(“value”) ? (string)Stringmap.Attributes[“value”] : string.Empty;

Int32 OptionLabel = Stringmap.Attributes.Contains(“attributevalue”) ? (Int32)Stringmap.Attributes[“attributevalue”] : 0;

}

}

 

 

B). JavaScript:

Using following API request we can get stringmap table in javascript

 

var req = new XMLHttpRequest();

req.open(“GET”, Xrm.Page.context.getClientUrl() + “/api/data/v9.1/stringmaps?$select=*&$filter=attributename eq ‘customertypecode’ and objecttypecode eq ‘account'”, false);

req.setRequestHeader(“OData-MaxVersion”, “4.0”);

req.setRequestHeader(“OData-Version”, “4.0”);

req.setRequestHeader(“Accept”, “application/json”);

req.setRequestHeader(“Content-Type”, “application/json; charset=utf-8”);

req.setRequestHeader(“Prefer”, “odata.include-annotations=\”*\””);

req.onreadystatechange = function() {

if (this.readyState === 4) {

req.onreadystatechange = null;

if (this.status === 200) {

var results = JSON.parse(this.response);

for (var i = 0; i < results.value.length; i++) {

var OptionLabel = results.value[i][“value”]; // Label

var OptionValue = results.value[i][“attributevalue”]; // Value

}

} else {

Xrm.Utility.alertDialog(this.statusText);

}

}

};

req.send();

 

C). SSRS Report (as optionset parameter):

One more use of stringmap entity is that we can use the same fetchxml to create dataset and pass parameter of optionset in place of hard coded value.

<fetch version=’1.0′ output-format=’xml-platform’ mapping=’logical’ distinct=’false’>

<entity name=’stringmap’ >

<attribute name=’attributevalue’ />

<attribute name=’value’ />

<filter type=’and’ >

<condition attribute=’objecttypecodename’ operator=’eq’ value=‘account‘ />

<condition attribute=’attributename’ operator=’eq’ value=’customertypecode‘ />//Field logical Name

</filter>

</entity>

</fetch>

 

 

Hope this will help you 😊

SQL Server Reporting Services (SSRS) Report Development (Adding parameters to report)– Part 2

In previous blog I have explored about how to start with SSRS reports.

https://pravinpawarweb.wordpress.com/2019/06/20/sql-server-reporting-services-ssrs-report-development-part-1/

“In the Information Age, the first step to sanity is FILTERING. Filter the information: extract for knowledge.” ― Marc Stiegler, Davids Sling

 

In this article will explore more about SSRS report like filtering report with the help of parameters and adding chart in report.

 

Step 1: Follow the steps to create new report as mentioned in first blog

Step 2: While adding query in Dataset type “@parametername” after value as shown in below screenshot.

1

2

Step 3: In my case I’m passing IndustryId, start date and end date as parameter where IndustryId is GUID of industry records. To pass multiple GUID of records create new dataset with master entity records as shown in below screenshot.

3

Step 4: Double click on IndustryId parameter and select available values in “Report Parameter Properties” to set IndustryId as GUID and Industry Name as parameter display name.

4.png

Step 5: In General section select data type as text, tick on “Allow blank value (“”)” and “Allow multiple values” to pass Id as optional or multiple values in IndustryId.

5.png

Step 6: Change data type of start date and end date as “Date/Time”. In my case start date and end date is createdon field.

6

Step 7: Add and update table/matrix as suggested in first blog.

7

Step 8: To add chart in report right click inside report and select chart option. Here we can create different types of chart such as column, shape, line etc. Select chart type and click on OK button.

8.png

Step 9: After adding chart click on chart to add series groups, category groups and aggregate function expression. You can preview groups in legend section. To show values inside chart right click on chart and select show data tables. Charts are useful to show statistical report in graphical format.

9.png

Finally upload report in CRM and click on run report to view chart. While running report you need to pass parameters to filter report.

10.png

 

Hope this help you 👍

 

 

 

SQL Server Reporting Services (SSRS) Report Development – Part 1

“The financial report makes it very clear that if we got into honest budgeting today, that in fact we would find ourselves with a much larger deficit than we have today”. Jim Costa.

 

To develop custom SSRS reports you must have to complete installation of SQL Server Reporting Services as well as MS Dynamics CRM Reporting Extension.

To download this setup, you can refer below urls:

https://docs.microsoft.com/en-us/previous-versions/mt429383(v=msdn.10)

https://www.microsoft.com/en-us/download/details.aspx?id=50375

After installation of above setup, we can develop FetchXml as well as SQL query based reports.

Let see step by step how we can develop and deploy SSRS report (using FetchXml)

1. Navigate to File -> New -> Project -> Expand Business Intelligence and select Reporting services.

Type name of project and select location of your machine to create and store report.

2. After creating project right click on Reports and select New Item.

1

3. Navigate to View in Visual Studio and select “Report Data” to add Data source and Dataset

Right click on Data Source and select Add Data Source. In Data Source Properties window, you can see to sections as ‘General’ and ‘Credentials’.

Type name of data source and select type of Embedded connection as “Microsoft Dynamics 365 Fetch” option from the drop-down list.

Type connection string as your org URL and org unique name (available inside Settings -> customization’s -> developer resources)

2

4. In Credentials section select “Use this username and password”. Type username and password of CRM user and click on OK button.

3

5. Now right click on Datasets and select Add Dataset. In Dataset properties type name of dataset, select “Use a dataset embedded in my report.” Choose newly created data source and in query type select Text radio button. Paste fetch xml in query text area (you can download it from Advance find -> Download FETCH XML)

4

6. After adding Data source and dataset right click inside report and add header and footer.

5

7. Right click in report and select insert table/matrix. New table will be created with empty columns and rows.

Type column names and bind rows with dataset fields.

6

You can also modify field value with customized expression. Right click on inside Text-box and select Expression. On Expression window you can choose all possible operators, functions to customize text-box value.

7

8. Login in to CRM with System Administrator and Navigate to Sales/Service/Marketing and click on ‘Report’ on sitemap area

Click on New button. It will open new window, expand Report type and select ‘Existing File’ and click on choose file and upload the .rdl file. Name will automatically populate on form moreover you can update it if required.

Choose the categories as where you want to execute report (Sales, service, marketing etc). Select the primary entity where you want to get values and execute report.

 

In Display In option choose required options, in my scenario I’ve created summary report and that’s why I’ve selected as ‘Report Area’.

8

Click on save or save and close button.

9. Finally, you can see your custom report in report list view. Select the report and click on “Run Report” button.

9

 

You will be able to see report in window where you can download report in .pdf, word, Excel, PowerPoint etc format.

 

In next blog I will explore more about SSRS report such as matrix reports, filter and parameters in report.

 

 

Hope this help you 👍