Hi,
We have a plugin on retrievemultiple for some entities. Based on user's division it filters the records on the views.
It works well in web application. But, it's not working in outlook.
Please help me with workarounds if anybody has faced similar issue.
This issue is both in 2011 and 2015.
Below is the code used in the plug-in:
if (context.InputParameters.Contains("Query") && context.InputParameters["Query"] is QueryExpression)
{
string targetEntity = context.PrimaryEntityName;
//get context user's division and retrieve VRs based on it
Guid ContextUserId = context.UserId;
var CurrentUser = service.Retrieve("systemuser", ContextUserId, new ColumnSet("divisioncode"));
if(CurrentUser.Contains("divisioncode"))
{
OptionSetValue UserDiv = (OptionSetValue)CurrentUser.Attributes["divisioncode"];
QueryExpression viewQuery = (QueryExpression)context.InputParameters["Query"];
if (viewQuery != null)
{
if (targetEntity == "entity")
{
ConditionExpression VRQuery = new ConditionExpression()
{
AttributeName = "division",
Operator = ConditionOperator.Equal,
Values = {UserDiv.Value}
};
viewQuery.Criteria.AddCondition(VRQuery);
}
}
}
}
Thanks.