Forums in Dynamics 365 Portal Add-on

In this blog we will be discussing about forums available on Portal Add-on in dynamics 365.
Firstly we understand major components in understanding the forums in Dynamics portal.

– Forums are basically open spaces for discussion among members for a specific topic. For eg: CRM, AX, BI, etc. We don’t have multiple forums for same topic.
Forum Threads – Forum Threads are the Problem/ Question/ Discussion Point associated under a forum. For eg: All questions related to CRM will be added as Forum threads under forum for CRM.
Forum Posts – Forum Posts are the Posts and replies on a same forum thread. For eg: All responses for a particular question on CRM will be added as Forum posts.

Steps to add new forum in CRM. (We can create new Forum for the portal only from CRM.)

  • Log in CRM.
  • Go to Community -> Forums


  • The list will show you already existing active forums.
  • Click on New, to create new Forum. (Ideally forum is topic specific. For eg: CRM, AX, BI, etc.)
  • Fill in the below details for the forum as in below image:


Name: Name of the forum.
Website: Website on which this forum is to be published.
Parent Page: Web Page under which you wish to display the forum.
Partial URL: Partial URL for the forum.
Publishing State: Publishing state of the forum page.
Forum Page Template: Page Template for the forum.
Description: Text that gives description for the Forum.
Thread Page Template: It indicates the page template to be used for Threads associated with Forum.

Few fields will be locked and auto-populated:
Thread count: Indicates number of threads for the forum.
Last Post: Lookup to last forum thread posted.
Post count: Indicates number of posts associated with the forum.

  • Click Save. This will save the Forum and you can now see it on the Portal.
  • Forum Threads: After saving the record you can now see all the associated threads in the sub-grid for Forum threads.
  • Announcements: You can also add announcements for a forum by adding announcement record for the forum from the Announcement grid.
  • Access Permission: You can also restrict a forum to set of users on the portal.

Forums in the Portal will look like in below images:

  • Forum list:
  • Forum Page (with list of threads for the forum and also the Announcement):

Note: In my next blogs I will try to cover Forum Thread and Forum Post in detail.


Show unrelated records in Sub-grid based on Lookup field


This blog intends to showcase the capability of displaying non-related records in a Sub-grid based on a field on the record.

There are 2 steps we need to follow to achieve it.

  1. We change the FetchXml attribute of the sub-grid.
  2. Hide ‘New’ and ‘Open Associated View’ buttons on the grid

1) We change the FetchXml attribute of the sub-grid:

Note: This is unsupported.

Script to change the FetchXML attribute for the sub-grid:
//' Display All Custom for associated Account
function DisplayCustomRecords() {
    //Declare variable
    var AccountID = "";
    var ObjSubGrid = "";

    //'Get SubGrid
    ObjSubGrid = window.parent.document.getElementById("id_of_subgrid");
       if (ObjSubGrid == null) {
        setTimeout(DisplayInitiatedToDoNext, 3000);
    } else {
        //Get Account ID
        AccountID = getLookupDetails('msdyn_serviceaccount');
        if (AccountID!= "") {
            //' Declare fetch XML
            var FetchXML="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>"
                                + "<entity name='entityname'>"
                                + "<attribute name='new_id' />"
                                + "<attribute name='new_name' />"
                                + "<attribute name='new_keyaccountid' />"
                                + "<order attribute='new_name' descending='false' />"
                                + "<filter type='and'>"
                                  + "<condition attribute='statecode' operator='eq' value='0' />"
                                  + "</filter>"
                                + "<link-entity name='account' from='accountid' to='new_keyaccountid' alias='aa'>"
                                        + "<filter type='and'>"
                                    + "<condition attribute='accountid' operator='eq' uitype='account' value='" + AccountID + "' />"
                                    + "</filter>"
                                    + "</link-entity>"
                              + "</entity>"
                            + "</fetch>"
            ObjSubGrid.control.SetParameter("fetchXml", FetchXML);
            //Refresh grid to show filtered records only. 
    function getLookupDetails(lookupSchemaName) {
        var lookupObj = Xrm.Page.getAttribute(lookupSchemaName); //Check for Lookup Object
        var lookupRecordGuid;
        //var lookupRecordName;
        if (lookupObj != null) {
            var lookupObjValue = lookupObj.getValue();//Check for Lookup Value
            if (lookupObjValue != null) {
                var lookupEntityType = lookupObjValue[0].entityType, //To get EntityName
                lookupRecordGuid = lookupObjValue[0].id; // To get record GUID
                //lookupRecordName = lookupObjValue[0].name; //To get record
        return lookupRecordGuid;



Note: FetchXMl used in above code is only for representational purpose. You have to generate your own FetchXML.

We will call above function on tab-state change event of the form. And set the tab, not to expand by default.



Note: Also there should be link-entity condition, rather than filter condition for Lookup field, based on which we will populate the sub-grid records.

Note: Another thing I observed is, many people face error, when they have multiple grids in a single tab. It is advised that we have our grid (whose records we are populating using above code), in an individual tab.

2) Hide ‘New’ and ‘Open Associated View’ buttons on the grid:

Another thing that we have to take care of, is to hide the ‘New’ and ‘Open Associated View’ buttons on the grid, since the script that we have written will not work on associated view page.

This we can achieve using Ribbon Workbench. You can attain that by following below link:

There is no need to using the script mentioned in the link. You can directly hide the buttons.

Pinning frequent Views and Records in Dynamics 365

Hello All,

Many times it becomes hectic for the end user to navigate among different records belonging to different entities. There are lots of clicks required. For instance, when a person wants to see ‘My Team Members Resolved Cases’ on the Case entity, while he is on the ‘Active Accounts’ view on Accounts entity. In that case, he will have to click on Service -> Cases -> then select the desired view.

Dynamics 365 helps achieve moving to particular View or record in a just a single-click.

Dynamics 365 offers pinning of the views and Records which are frequently visited.

This pinned views and records, appear in the recent records section in the ribbon.

You can pin/unpin records as per your convenience.

[Resolved] – EntityState must be set to null, Created (for Create message) or Changed (for Update message)

Recently I was facing an issue with Update of a record in the Plugin. The error message was as ‘EntityState must be set to null, Created (for Create message) or Changed (for Update message)’.

The plugin was written on Post-Operation of Create action.

After looking for the resolution for the issue, I came across a solution posted online, which I am not sure, is supported, but worked for me.

Before calling the _service.Update(Entity), You need to change the state of entity as below:

recordToUpdate.EntityState = EntityState.Changed;

Hope this helps.

Also there is another approach to resolve this:

Instead of using





The request channel timed out while waiting for a reply after 00:01:59.9430000. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout. dynamics crm

Recently I was facing another issue with BulkInsert from my console to D365, using ExecuteMultiple. As per the documentation on MSDN, ExecuteMultiple has run-time limitation to have maximum batch-size of 1000.


However, I was facing time-out issue for 999.

Turns out, I need to specify a smaller batch size to overcome this issue.

Specifying batch size as 500 was working fine for me.

Custom CSS for Dynamics CRM Portals

This blog is intended to showcase capabilities of Dynamics CRM portals to accommodate custom CSS for UI changes.

For adding any custom CSS for the portal, we need to add bootstrap.min.css as a child file of “Home page” on the portal.

Steps for adding CSS file on portal:

Step1: Create a custom bootstrap.min.css having required changes for the UI of the portal.

You can create custom CSS using below references:

Step2: Login into the Portal with credentials having Administrator security role.

Step3: Navigate to Home page.

Step4: Add a new Child file to Home page using “Administrator” panel on the upper right side of the screen.


Step5: Browse the updated bootstrap.min.css.

Name and partial URL fields will be auto-filled.


You can choose to hide the child file from the Site map.

Step6: Click on Save.

By performing above steps, you can have custom UI changes on the Portal.

Note: In some cases, changes are not reflected immediately on the portal. For this, kindly restart the portal and check.