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

Day 11 - Customizing Option Sets Dropdown Fields with JavaScript

  In this Blog, we will see how to Customizing Option Sets Dropdown Fields with JavaScript label1 = formContext.getAttribute( "bosch_op...