locked
RetrieveMultiple plugin is not working in Outlook Client RRS feed

  • Question

  • Hi,

    We have a RetrieveMultiple plugin to filter records in the views based on User's division.

    This plugin works well in CRM application (MSCRM 2015 on-premise) but records are not getting filtered in Outlook client.

    Below is the code being used in the plugin:

    if (context.InputParameters.Contains("Query") && context.InputParameters["Query"] is QueryExpression)

                   {

                       string targetEntity = context.PrimaryEntityName;

                       Guid ContextUserId = context.UserId;

                       var CurrentUser = service.Retrieve("systemuser", ContextUserId, new ColumnSet("new_division"));

                       if (CurrentUser.Contains("new_division"))

                       {

                       OptionSetValue UserDiv = (OptionSetValue)CurrentUser.Attributes["new_division"];

                       QueryExpression viewQuery = (QueryExpression)context.InputParameters["Query"];

                           if (viewQuery != null)

                           {                           

                               if (targetEntity == "new_testplugin")

                               {

                                   ConditionExpression VRQuery = new ConditionExpression()

                                   {

                                       AttributeName = "new_division",

                                       Operator = ConditionOperator.Equal,

                                       Values = {UserDiv.Value}

                                   };

                                   viewQuery.Criteria.AddCondition(VRQuery);

                               }

                           }

                       }

                   }

    Kindly help us with the work arounds.

    Thanks in Advance..


    Rabison

    Monday, August 24, 2015 8:17 AM

All replies

    • 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);
      }

      }

      }

      }

    Monday, August 24, 2015 10:30 AM