Показать сообщение отдельно
Старый 19.11.2008, 10:30   #3  
Alir is offline
Alir
Участник
 
47 / 14 (1) ++
Регистрация: 02.08.2008
Адрес: Санкт-Петербург
Артем Enot Грунин

Код здесь обычный, как пример SDK:
X++:
            WhoAmIRequest systemUserRequest = new WhoAmIRequest();
            WhoAmIResponse systemUser = (WhoAmIResponse)service.Execute(systemUserRequest);
 
            activityparty party = new activityparty();
            party.partyid = new Lookup();
            party.partyid.type = EntityName.systemuser.ToString();
            party.partyid.Value = systemUser.UserId;
 
            email email = new email();
            email.to = new activityparty[] { party };
            email.from = new activityparty[] { party };
            email.subject = "My test subject";
            email.description = "My test send e-mail message";
 
            CrmBoolean direction = new CrmBoolean();
            direction.Value = true;
            email.directioncode = direction;
 
            // создаем так:
            TargetCreateEmail targetCreate = new TargetCreateEmail();
            targetCreate.Email = email;
            CreateRequest request = new CreateRequest();
            request.Target = targetCreate;
            service.Execute(request);
            
            //либо так:
            //service.Create((BusinessEntity)email);
Строчка где Create или Execute падает. Абсолютно этот же код отрабатывает в win приложении, а в плагине нет. Потому думаю дело тут не в коде, а именно в плагине.

Причем любая другая сущность создается, а email нет.

Плагин регестрировался Plugin Resistration Tool на Update одного поля - собственно все как обычно.