{Thank You Note} It’s 50 not out and counting for our SharePoint Attachment Uploader and Metadata Manager tool

A big thanks to all our customers who has helped us in our journey so far. Without your support, we would not have been able to reach this far.

A new version of the tool awaits with new feature and UI and is going to be released soon.

Thanks a lot for your support



Video Link – https://www.youtube.com/watch?v=BIhsOD0gbew


To know how we can help you, write to us at info@xrmforyou.com or visit our website – www.xrmforyou.com

{Quick Tip} Pass a custom single/ collection of objects with Custom Properties as Output parameter from Actions in Dynamics 365

One of the great features that got introduced with Dynamics 2013 was Actions. With time more & more improvement came in with Actions and today Actions are one of the most powerful extending features in Dynamics.

And here I was designing actions for a client. Coming quickly to the requirement, the client had an action where they were determining complex business logic in the action with some input parameters and then based on the calculation, they need to pass back multiple values back to the invoker of the action.

There can be multiple ways to do this and one can be pass each of these values of Output Parameters. But that did not go well with the customer as around 15 properties needed to be returned from the action.

So the client developer came up with a DataModel class something similar to this.


internal class OutputClass


public string Property1{get;set;}




public decimal Property15{get;set;}



Nothing fancy. all the developer was doing was mapping the properties of this class and then the object back to the invoker of the action. But how to do it? Does Action allow custom object types to be passed as return parameters. Well,direct answer is No. But there are ways.

  • serialize the object into JSON and put the output JSON string through a string Output parameter – Didn’t go well with the customer. Has to abandon
  • serialize the object into XML and put the output XML string through a string Output parameter – Didn’t go well with the customer. Has to abandon again.


What I am left with then? We all know that it supports entity and entitycollection as output parameter types. But how do I use them to accomplish my goal here. The customer is not willing to create any Entity specifically for this.

Well a bit of trial and finally I achieved the below as workaround.

1. Passing a single Object back.

Well for this I used the entity parameter and just selected the Account Entity as Entity Type. You can use any Entity here. Does not matter.



In the plugin registered on the Action step, after calculating all the properties, I am setting the Output parameter like this.

var ent = new Entity("account");
ent["mytestproperty"] = "Test Name";
ent["mytestproperty2"] = 1;

ent["myentityreference"] = new EntityReference("contact", Guid.NewGuid());

context.OutputParameters["EntityParam"] = ent;

Observe carefully the code above. I am just creating an entity at runtime of type “account”. I don’t need to even specify the Guid. And then I can just put my custom property names for the entity and assign values of entity type – string/ int/ decimal/ entityreference etc.

None of these properties are present in the account entity. The trick is CRM framework does not validate the fields of the entity. So you can just return the entity object back with your own parameters. Cool trick. Isn’t it.

And below is the output received by the invoker of the action.



2. Passing Multiple Objects of Different type

For this, I used the entity collection as Output parameter



And below is the code to set the values.

var ent = new Entity("account");
           ent["mytestproperty"] = "Test Name";
           ent["mytestproperty2"] = 1;
           ent["myentityreference"] = new EntityReference("contact", Guid.Empty);

           var ent2 = new Entity("contact");
           ent2["mytestproperty"] = "Test Name";
           ent2["mytestproperty2"] = 1;
           ent2["myentityreference"] = new EntityReference("contact", Guid.Empty);


           context.OutputParameters["CollectionParam"] = collection;

First we have to understand that entitycollection is a collection of entities. It does not necessarily imply collection of entities of the same type. This is a common misconception I find among so many people in spite of working on CRM for quite sometime.

As you can see, both the entities are of different types and can have completely different properties. Cool isn’t it?

And Below is the result the invoker of the action receives.



Personally if you ask me, I would still prefer serializing the object into JSON or XML. However if your customer prefers Entity or EntityCollection, this workaround I hope helps you.


Debajit Dutta

(Dynamics MVP)

For corporate training/ consulting/ tools, please visit our website www.xrmforyou.com or write to us at info@xrmforyou.com

Place custom button on Registration Page in Dynamics 365 Portals

Recently I had a requirement where my customer wanted to put a Cancel button in the registration screen of Dynamics 365 Portal. To explain the requirement, the OOB screen looks like below.


What my customer wanted was to place the Cancel button beside the Register button. So that when he clicks on the Cancel button, it should throw the user back to the login page.

So let’s see how to do it.

Step 1: Create a content snippet

Go to settings –> portals –> content snippets

Create a content snippet with Name = Account/Register/PageCopy and Type = HTML. Check for the below screenshot


Save the record.


Step 2: Write the content of the HTML to render the Cancel button

Copy and paste the below in the Value (HTML) field

$(document).ready(function () {

$submitButton = $(“#ContentContainer_MainContent_MainContent_SecureRegister”).find(“#SubmitButton”);

$submitButton.parent().append(“<input type=’button’ id=’btn_cancel’ class=’btn btn-primary’ value=’Cancel’ />”);

$(“#btn_cancel”).click(function () {

window.location.href = “https://xrmforyou.microsoftcrmportals.com&#8221;;




There is one trick here. If you just Copy/ Paste the above code in the HTML field, it will render as text on the Registration Page.


So the trick is to follow the below steps before copy/ pasting the above code.

Click on the Source Icon as highlighted below. Once you click, it becomes a HTML editor.


Now copy and past the above code.

Save and refresh your portal.



Hope this helps!


Debajit Dutta

(Dynamics MVP)

For corporate training/ consulting, please write to us at info@xrmforyou.com

Security Nuances with Manager Based Hierarchy in Dynamics 365

Manager Hierarchy was introduced way back with 2015 Online Update 1. And you might be wondering why this blog after years this feature has been introduced?

Well I can assure you, you won’t be disappointed after reading this blog. In this blog I will explain in detail the manager security nuances from my personal experience with project implementations and training. I am not going to explain how Manager security works. I am just going to explain the security nuances and how it works in multiple scenarios.

To explain my point, I have the below data set-up in my environment.

1. Business Unit Set-up

  • Americas –> Child BU of Root BU
  • North America –> Child BU of Americas

2. User Set-up

  • User A belonging to Americas BU
  • User B belonging to North America and reporting to User A
  • User C belonging to North America

3. Created Custom Entity named – Manager Hierarchy Test

4. Security Roles

  • Manager Role – having User level access on all privileges on the entity Manager Hierarchy Test
  • Reportee Role – having BU level access on all privileges on the entity Manager Hierarchy Test

5. User A is assigned Manager role and User B and User C having Reportee Role

So Manager Hierarchy affects which record? To put in my words

  • Owned by Reportee
  • Shared to Reportee
  • Owned by a team to which Reportee is a team member
  • Shared by a team to which Reportee is a team member

Which records are not affected by Manager Hierarchy ?

To put in simple terms, any of the records which does not meet the above four conditions is not affected by Manager Hierarchy. So the records which the reportee gains access due to his security prvileges (Business Unit/ Parent child/ organization) are not affected by this. Confused? Don’t worry. We will come back to this.


So let’s take these scenarios one by one.

Scenario 1:

Record owner = Reportee

User B creates a record – ‘Record for User B’. So this record is being owned by User B.  As per Manager Hierarchy, user A is able to read/ write this record since User B is direct reportee of User A. No surprises here right. After all everyone knows that.

First of all, to have write access to the reportee record, User A should be having at-least user level write privilege on the entity through his security role. Otherwise he won’t be able to write the reportee’s record even through Manager Hierarchy.

Also another point –Delete” privilege is not part of Manage security. Hence Manager won’t be able delete the reportee’s record.


Scenario 2:

Record shared to Reportee

Another user shares a record with User B with all the privileges – Read/ write/ append/ append to/ share. User A will now see this record because of Manager Hierarchy. However although the reportee have all the privileges on this record by virtue of sharing, through Manager Hierarchy, User A will only have read-only access to this record.


Scenario 3:

Record owned by a team which the reportee is member of

this behavior is same as Scenario1


Scenario 4:

Record Shared to a team which the reportee is member of

This behavior is same as Scenario 2


Now say for example User C goes ahead and creates record. Since User B and User C are both in the same business Unit (North America in example here), by virtue of their business unit read privilege on security role, User B would be able to see the record. However since User B is not the owner/ not shared to him/ not owned by the team to which he belongs/ not shared to the team to which he belongs, this record is not affected by Manager hierarchy and hence User A is not able to view this record.


Hope this clears out any doubt with Manager Hierarchy.

Debajit Dutta

(Dynamics MVP)

For corporate training/ consulting, please reach out to us at info@xrmforyou.com or visit our website – xrmforyou.com

{Quick Tip} Restrict To Lookup of email to allow only a record in Dynamics 365

Nothing like real time requirements and here is another one. Customer walks in and puts in his requirement – “Users should not be able to select more than one record in the To field of CRM”. We suggested that while sending the email, we would put a validation which would stop the user from sending the email if more than one record is there. Well as everybody knows, more often than not, customer has his way and then we were back to the drawing boards trying to figure out how to do it.

For starters, To field in Dynamics allows you to select more than one record of multiple entity types which is obvious isn’t it. Below is the UI which allows you to do that.



Fortunately we found out a way. This is what we did.

  • Created a solution. Added Email entity and the To field to it.
  • Exported the solution
  • Unzipped the solution and opened up customizations.xml file in a XML editor.
  • Navigated to the area where To attribute is there in the XML file.


  • Added the below in the XML file just above <displaynames> tag.


  • Re-zipped the files. Imported the solution back and Publish all customizations.
  • And now when you click the To field, this is what you get.



Mission accomplished!

Hope this helps.


Debajit Dutta

(Dynamics MVP)

For training/ consulting, please write to us at info@xrmforyou.com

{Quick Tip} Restrict From Lookup in Dynamics 365 email to only queue–Without addCustomFilter or Unsupported Jscript

This is an old topic which is getting discussed since CRM 2011 or I think even before that. You must be wondering, why I am digging out history here. Well there has been so many blogs written about this.

So what’s the problem statement here?

Recently my customer wanted that whenever an email is being sent from Dynamics, it only needs to be sent through Queues. In other words in the From Lookup of the email, the user should not be able to select self or any other user from CRM.

So there are basically two steps to it. Since from is a multi-entity lookup, it shows both the user and queue when user tries to select.

So the first thing needed is to stop the user from selecting the user entity and the next is to stop the user from selecting any user record in from.

To achieve the first problem statement, so many blogs have been written but they use unsupported Javascript to meddle with the UI element and disable the dropdown. We will not do that here.

The other option, supported way, is to use the addCustomFilter. But with that, even though you stop from selecting a user, still the Entity selection of User/ Queue is available.

So wanna try something new? Let’s do this.

  • Create a solution and add the Email entity to it. While adding the entity, to keep the solution simple, just add the from field to it (only for CRM 2016 and above. Prior versions, you are not luck to choose the options)
  • Export the solution as Unmanaged
  • Unzip the solution. You should see three file
    • Customization.xml
    • Solution.xml
    • [Content_types].xml
  • Open the Customization.xml in a XML editor of your choice and navigate to the section where the From field is present.


  • You may find the unmodified=”1” in the attribute element as well as Email entity element. Remove the tags. Otherwise any changes you make here may not reflect in CRM once you import back.
  • Scroll down a bit and you will see the section with the LookupType tag.


  • Remove the entire element corresponding to 8 (Type code for user). Your final XML should just contain the one LookupType tag with Queue (2020).
  • All set and done, select the three files and re-zip them


  • Re-import the solution and publish all customizations.
  • Now go back to your CRM email. Try to select “from”. And get the delight. Now entity selection is disabled and you are just left with selecting the queue.