Friday, 12 May 2017

Dynamics 365 – Apply sorting on Composite Columns


Those working on CRM views might have often felt the need to be able to sort on composite columns (e.g. address).

As we see in the below screen print. The available columns for sorting do not contain composite field Address even when Address is a part of the view.



OOB CRM does not allow this. Here, I am sharing a simple solution for sorting on composite columns.

Note the name of the view in concern.

Create a solution with that view as a component and export it.
Extract the exported zip file.
Open customizations.xml and locate your view.

You will see that the address column has an attribute ‘disableSorting=”1”’ as shown in the below screenshot. Delete that attribute from the cell.




Compress the files back and rename the zip file to the name of the solution.





Import the solution back to CRM. Do not forget to publish the solution.
That’s it. Now, if you check your view, you will be able to sort on Address filed also.



You can also use the same approach if you are unable to sort on fields picked up from related entities.

Hope it helps!


A simple and quick way to insert data into Many-to-Many relationship in Dynamics CRM is the Drag and drop listbox.
http://www.inkeysolutions.com/what-we-do/dynamicscrmaddons/drag-and-drop-listbox

Friday, 9 December 2016

Want to integrate Outlook 365 / web outlook with Dynamics CRM Online? Below is the solution...

 

The preferred way to integrate Microsoft Dynamics 365 Online with Outlook 365 is to use the Dynamics 365 App for Outlook paired with server-side synchronization. You no longer need to use the legacy Dynamics 365 for Outlook add-in.

First you need to configure server side synchronization to start email send and receive functionality. You can get more help here for this topic.

Next step is to set up required privilege. You need to give the user the “Use Dynamics 365 App for Outlook” before he can access this app through Outlook.

Follow the steps listed below for this.

1. Go to Settings > Security.

image

2. Select the security role which you will use for configuration and click Business Management. Here in this post, I have configured it for Salesperson role.

image

2 (a) In the Entity section, ensure that the settings for “Mailbox” are set to User or higher.

image

2 (b) Also, in the Privacy Related Privileges section, verify that the “Use Dynamics 365 App for Outlook” is set to Organization.

image

Apart from these steps, you also need to provide the user with read/write privileges for the following entities:

Business Management Tab

  • Mailbox (organization level)

Customization Tab

  • Entity (organization level)

  • Field (organization level)

  • Relationship (organization level)

  • System Application Metadata (organization level)

  • System Form (organization level)

  • User Application Metadata (user level)

  • View (organization level)

The final step is to push the app to the users. You can choose to automatically add the app to Outlook whenever a user becomes eligible to use the app or else you can manually select to which users you need to push the app.

First go to Settings >CRM App for Outlook.

image

Then, to automatically add the app to Outlook for the first time, click the “Automatically add the app to Outlook” in Settings section and save the changes. For performing this step second time and later, you will have to click “edit” (link besides “Settings”).

image

To manually push the app to the users (either all or selected), you can use the section below the save button.

Once the application is pushed to Outlook Online, users can “track” an email. This is done by selecting the email and on the right hand side section click the “Dynamics CRM” link and then click “Track”.

The screen-shot below shows an already tracked email, hence it shows the “Untrack” button. Here, we have no contact associated with this email in CRM, so Dynamics CRM offers us to create a new contact.

I leave it to you to explore more in this Dynamics CRM section on your own.

image

That’s it, you can access CRM right from your web Outlook!

Cheers!

 


A simple and quick way to insert data into Many-to-Many relationship in Dynamics CRM is the Drag and drop listbox. http://www.inkeysolutions.com/DynamicCRMDragAndDropListBox.html

Tuesday, 18 October 2016

Want to delete a managed component? Use the clone solution feature in CRM 2016.



Have you ever had the need to delete a component present in a managed solution? Let’s say, I have a solution ‘Delete From Managed’ with two entities ‘Entity to Retain’ and ‘Entity To Delete’ at the development server. I export it as a managed solution and then import it at the production server. Everything works fine. Some stage later, you find that ‘Entity To Delete’ is no longer needed and you want to remove it from the production server, but you cannot do so because the solution is a managed one. What do I do now?

Before CRM 2016, there was a work around to this issue i.e. holding solution. In CRM 2016 I’ve found that we could use the clone solution feature to complete this task.

Let’s see it step by step.



The screen below shows my original solution.









First, I clone the solution at the development server.




























Notice that cloning solution increases the version number of the solution.

I then, delete the unused entity ‘Entity To Delete’ from the solution. I export it again as a managed solution and then import it at the production server.

The initial screen while importing, where I select the zip file, is shown below,












I click next and get the following screen,


















I click next again, and get the following screen,




















This is an important step. Here we need to make sure that we select the check box named ‘Stage for Upgrade’.

I click ‘Import’ and the import starts.

Once the import finishes successfully, your CRM instance will have two solutions,

  • DeleteFromManaged
  • DeleteFromManaged_Upgrade (CRM creates this renamed solution)


And you are presented the following screen,




















Click ‘Apply Solution Upgrade’.

CRM 2016 will create a solution named same as your solution, but with a suffix ‘_Upgrade’. CRM 2016 will automatically manage to delete the component for you, and at successful completion of this step, you will only have one final solution named ‘DeleteFromManaged’. The entity ‘Entity To Delete’ will no longer be present at the production server.



Hope this helps!!!





A simple and quick way to insert data into Many-to-Many relationship in Dynamics CRM is the Drag and drop listbox. http://www.inkeysolutions.com/DynamicCRMDragAndDropListBox.html

Tuesday, 6 September 2016

Points to be kept in mind while working with FetchXML

Few days back, I was asked to write FetchXML that would give a list of incidents, which were shared with a team.

The result should contain incident details along with the names of the teams with which the incident was shared.

The result was ought to have 4 fields,

  • title
  • createdon
  • incident
  • team

I wrote the below mentioned FetchXML for this requirement.

<fetch version="1.0output-format="xml-platformmapping="logicaldistinct="false>
<entity name="incident>
<attribute name="title/>
<attribute name="createdonalias="createdon/>
<attribute name="incidentid/>
<link-entity name="principalobjectaccessto="incidentidfrom="objectidlink-type="inneralias="share>
<filter type="and>
<condition attribute="accessrightsmaskoperator="nevalue="0/>
<condition attribute="principalidoperator="not-null/>
</filter>
<link-entity name="teamfrom="teamidto="principalobjectaccessidlink-type="outeralias="team>
<attribute name="namealias="teamname/>
</link-entity>
</link-entity>
</entity>
</fetch>

The equivalent T-SQL for this will be,

SELECT
i.title,
i.createdon as createdon,
i.incidentid,
t.team as teamname
FROM incident i
INNER JOIN principalobjectacess p ON i.incidentid = p.objectid AND accessrightsmask <> 0
INNER JOIN team t ON t.teamid = p.principalobjectaccessid.

Please take a look at following link for “principalobjectaccess, if you are not familiar with it.

The problem

With this fetchxml, somehow, the result did not include the field of ‘team’ entity. But why?

I took help of XRMToolBox (http://www.xrmtoolbox.com/) to find the reason for the issue and tried executing the FetchXML on a CRM instance whose database was accessible to me.

I executed SQL queries to review the data and found that there was no team related to any of the incidents.
Hence, I shared an incident with a team and analyzed the data in the principalobjectaccess table.
With this change I was able to see the expected data in the SQL query.

And while observing the data, I found that the field ‘principalobjectaccessid’ that I used in to field was incorrect and I needed to use the field ‘principalid’ for join purposes.

Thus, based on the working with SQL query, I modified my fetchxml with the correct field value.
Along with this, I also removed the alias “teamname”.

I made these changes and tested it again. This time it gave me the correct results. The following is the modified FetchXML.

<fetch version="1.0output-format="xml-platformmapping="logicaldistinct="false>
<entity name="incident>
<attribute name="title/>
<attribute name="createdonalias="createdon/>
<attribute name="incidentid/>
<link-entity name="principalobjectaccessto="incidentidfrom="objectidlink-type="inneralias="share>
<filter type="and>
<condition attribute="accessrightsmaskoperator="nevalue="0/>
<condition attribute="principalidoperator="not-null/>
</filter>
<link-entity name="teamfrom="teamidto="principalidlink-type="outeralias="team>
<attribute name="name/>
</link-entity>
</link-entity>
</entity>
</fetch>


Results were,

<result>
<title>
MyTitle
</title>
<createdon date="09/01/2016time="4:00 PM>
2016-09-01T16:00:00+05:30
</createdon>
<incidentid>
{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
</incidentid>
<team.name>
XXXX
</team.name>
</result>


Points to be kept in mind while working with FetchXML,

  • The fields mentioned in FetchXML linked entity will only show up in the results if a linked entity record is actually present, otherwise the FetchXMl will simply ignore the fields.
  • If we want an attribute of linked entity in the results, we should not give alias to it. Like, in aforesaid fetchxml, we want team name in the output, so I have not given an alias to it.
  • Whenever we link one entity to another in Fetchxml, we should always keep in mind that the from field comes from the linked entity and to field comes from the main entity. Like, in aforesaid fetchxml, the from field has to be from the team entity.
            <link-entity name="teamfrom="teamidto="principalidlink-type="outer>


Hope this helps!





A simple and quick way to insert data into Many-to-Many relationship in Dynamics CRM is the Drag and drop listbox. http://www.inkeysolutions.com/DynamicCRMDragAndDropListBox.html