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