Wednesday, March 9, 2016

Set Default Dashoard MSCRM C#

Hi,

Please find the code below for setting Default Dashboard while Associating Role to Particular User





EntityCollection loaddashboards = GetDashboardGuid(dashboardname);
Entity roles = new Entity("usersettings");
roles.Attributes["systemuserid"] = UserID;
roles.Attributes["defaultdashboardid"] = loaddashboards.Entities[0].Attributes["formid"];
orgService.Update(roles);


private EntityCollection GetDashboardGuid(string name)
        {
            QueryExpression qry = new QueryExpression("systemform");
            qry.ColumnSet.AddColumns("name", "formid");
            qry.Criteria.AddCondition(new ConditionExpression("name", ConditionOperator.Equal, name));
            EntityCollection loaddashboards = orgService.RetrieveMultiple(qry);
            return loaddashboards;
        }

No comments:

Post a Comment

How to Run Microsoft Flow for Every one Month

Introduction: In this Blog we will see how to Run Microsoft Flow for Every one Month. Implementation Steps:   1. Navigate to  https://make.p...