none
Erro ao executar query no WorkFlow para localizar e-mail na fila. RRS feed

  • Pergunta

  •          Bom dia a todos ,

    estou com um problema em um metodo onde eu tento localizar o [QueueItemId] de um [email] na [queueitem]. Mas na hora de exexutar o comando [BusinessEntityCollection _Bec = service.RetrieveMultiple(_Query);] ele da uma [Exception]

    Obs: esse erro so ocorre qndo eu rodo o metodo [getQueueIDByEmail] não ocorre para o metodo [getEmailByRegardindID


    Alguem saberia me ajudar?   
    Grato.


    Codigo dos 2 metodos:

     
            private queueitem getQueueIDByEmail(Guid guid, ICrmService service)
            {

                QueryExpression _Query = new QueryExpression();
                _Query.EntityName = "queueitem";
                _Query.ColumnSet = new AllColumns();

                ConditionExpression _ce1 = new ConditionExpression();

                _ce1.AttributeName = "objectid";
                _ce1.Operator = ConditionOperator.Like;
                _ce1.Values = new object[] { guid.ToString() };

                FilterExpression _FilterExpression = new FilterExpression();
                _FilterExpression.FilterOperator = LogicalOperator.And;
                _FilterExpression.Conditions.Add(_ce1);


                _Query.Criteria = _FilterExpression;
                BusinessEntityCollection _Bec = service.RetrieveMultiple(_Query);

                queueitem oQueue = null;

                if (_Bec.BusinessEntities.Count > 0)
                {
                    oQueue = _Bec.BusinessEntities[0] as queueitem;
                }

                return oQueue;

            }

            private email getEmailByRegardindID(Guid guid, ICrmService service)
            {
                QueryExpression _Query = new QueryExpression();
                _Query.EntityName = EntityName.email.ToString();
                _Query.ColumnSet = new AllColumns();

                ConditionExpression _ce1 = new ConditionExpression();

                _ce1.AttributeName = "regardingobjectid";
                _ce1.Operator = ConditionOperator.Like;
                _ce1.Values = new object[] { guid.ToString() };

                FilterExpression _FilterExpression = new FilterExpression();
                _FilterExpression.FilterOperator = LogicalOperator.And;
                _FilterExpression.Conditions.Add(_ce1);
               

                _Query.Criteria = _FilterExpression;
                BusinessEntityCollection _Bec = service.RetrieveMultiple(_Query);

                email oEmail = null;

                if (_Bec.BusinessEntities.Count > 0)
                {
                    oEmail = _Bec.BusinessEntities[0] as email;
                 }

                return oEmail;
            }


           

    segunda-feira, 3 de agosto de 2009 13:40

Respostas