Показать сообщение отдельно
Старый 29.03.2010, 14:12   #3  
Skyway is offline
Skyway
Участник
 
78 / 10 (1) +
Регистрация: 07.08.2009
У меня просто в тот момент под рукой кода не было, поэтому не опубликовал... Сейчас
X++:
   if (((DemandStatus == "1. Черновик") || ((DemandStatus == "3. Не согласованно") && (((Key)currLetter.Properties["ownerid"]).Value == ((Key)currLetter.Properties["new_person"]).Value))) && (SendState.Value == true))
                {

                    SecurityPrincipal assignee = new SecurityPrincipal();
                    assignee.Type = SecurityPrincipalType.User;


                    // PrincipalId is some known Guid belonging to the user or team that will own this record.
                    assignee.PrincipalId = new Guid("923D790F-512B-DE11-A2A2-000E0C4BF7BF");

                    TargetOwnedDynamic dyn = new TargetOwnedDynamic();
                    dyn.EntityName = "new_business_trip";
                    dyn.EntityId = ((Key)(entity.Properties["new_business_tripid"])).Value; 

                    // Create the request object.
                    AssignRequest assign = new AssignRequest();

                    // Set the properties of the request object.
                    assign.Assignee = assignee;
                    assign.Target = dyn;

                    // Execute the request.
                    ICrmService KSservice = context.CreateCrmService(true);
                    try
                    {
                        AssignResponse assignResponse = (AssignResponse)KSservice.Execute(assign);
                    }
                    catch (Exception ex)
                    {
                        //TODO: Exceptionhandling
                    }
                    entity = (DynamicEntity)context.InputParameters.Properties[ParameterName.Target];
                    
                    CrmBoolean CrmTrue = new CrmBoolean(true);
                    entity.Properties["new_send_state"] = CrmTrue;
                    KSservice.Update(entity);

                }
Ошибка: Server was unable to process request.
Без последних четырех строчек все выполняется нормально.