Friday 14 January 2022

In subject lookup, some subject items are not showing Dynamic 365 CRM

 I faced a scenario where some subject items are not showing in subject lookup.

We are using Subject lookup on the Case form and creating cases for different subjects.

We have added a new subject in the subject entity but it's not showing in the subject lookup.


The issue is coming because there is an OOB field in the subject entity with a name featuremask and its value is null.


So I have updated its value to 1 then it's showing. by the following query.

update subject set featuremask = 1 where subjectid = "Provide your subject id here"










Friday 7 January 2022

filter subgrid lookup view dynamically in Unified Interface Dynamic 365

I faced a scenario where the client want to filter subgrid lookup view dynamically


We have two custom entities with the name Case filling and Application Party, both entities have a lookup of Case entity.

Case Filling entitiy has one to many relationship with the Application Party entity.

On Case filling entity subgrid of Application added.

the client wants to show only those records in subgrid add existing lookup view which is related to the case entity which is set on case filling.


To achieve the above goal I customized the command of Add existing button of Appliation entity.

and bind a js webresource.



When clicking on add existing button a lookup view dialog is opened, the client want to show only those record which is related to the case entity.






I used the below Js code and filter records dynamically by taking help from this link.

function filterApplicationLookupView(formContext) {

    debugger;

    var caseid = null;

    var searchText = "";

    //var formContext = executionContext.getFormContext();

    if (formContext.getAttribute("ms_case") != null && formContext.getAttribute("ms_case").getValue() != null)

        caseid = formContext.getAttribute("ms_case").getValue()[0].id;


    caseid = caseid.replace("{", "").replace("}", "");


    if (caseid != null) {

        var lookupOptions = {

            defaultEntityType: "ms_applicationparty",

            entityTypes: ["ms_applicationparty"],

            defaultViewId: "B538E004-8EE7-4B33-B51F-2F97A62C940A",

            viewIds: ["B538E004-8EE7-4B33-B51F-2F97A62C940A"],

            allowMultiSelect: true,

            disableMru: true,

            filters: [{ filterXml: "<filter type='and'><condition attribute='ms_case' operator='eq' value='" + caseid + "' /><condition attribute='ms_casefiling' operator='null' /></filter>", entityLogicalName: "ms_applicationparty" }],

            searchText: ''

        };

        Xrm.Utility.lookupObjects(lookupOptions)

            .then(

                function (result) {

                    if (result == null || result.length == 0) {


                    } else {

                        var appParties = [];

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

                            appParties.push(result[i].id)

                        }

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

                            var appPartyId = appParties[i];

                            appPartyId = appPartyId.replace("{", "").replace("}", "");

                            UpdateCaseFillingOnApplication(appPartyId);

                        }

                    }

                });

    }

}

function UpdateCaseFillingOnApplication(appPartyId) {

    debugger;

    var serverURL = Xrm.Page.context.getClientUrl();

    var fillingId = Xrm.Page.data.entity.getId();

    fillingId = fillingId.replace("{", "").replace("}", "");

    var filling = {};


    //Lookup

    filling["ms_CaseFiling@odata.bind"] = "/ms_casefilings(" + fillingId + ")";  //setting existing lookup



    var req = new XMLHttpRequest();

    req.open("PATCH", serverURL + "/api/data/v9.0/ms_applicationparties(" + appPartyId + ")", false);

    req.setRequestHeader("Accept", "application/json");

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

    req.setRequestHeader("OData-MaxVersion", "4.0");

    req.setRequestHeader("OData-Version", "4.0");

    req.send(JSON.stringify(filling));


    if (req.readyState == 4 /* complete */) {

        if (req.status == 204) {


        } else {


        }

    }

}








Numbering Table Parent group and child group ssrs report

 Recently I have faced a scenario to numbering parent group and subgroup in the following formate 10 parentGroupRow1    10.1 childGroupRow1 ...