Sunday, 1 September 2013

Plugin Code to get Role Id of Team



        //Function to get the Id  of the Team role passing the buid and org service
        private Guid getRoleId(IOrganizationService crmServ, Guid buId)
        {
            #region get roleId
            Guid recordId = new Guid();
            QueryExpression query = new QueryExpression
                       {
                           EntityName = "role",
                           ColumnSet = new ColumnSet("roleid"),
                           Criteria = new FilterExpression
                           {
                               Conditions =
                            {
                                   
                              new ConditionExpression
                                {
                                    AttributeName = "name",
                                    Operator = ConditionOperator.Equal,
                                    Values = {"Team Name"}
                                },
                                new ConditionExpression
                                {
                                    AttributeName = "businessunitid",
                                    Operator = ConditionOperator.Equal,
                                    Values = {buId}

                                }
                            }
                           }
                       };

No comments:

Post a Comment