Показать сообщение отдельно
Старый 12.03.2013, 16:21   #1  
Taker1796 is offline
Taker1796
Участник
Аватар для Taker1796
 
112 / 11 (1) +
Регистрация: 22.04.2012
Вызов плагина одной crm с риббона другой
Всем привет. Собственно пытаюсь реализовать штуку, которая при нажатии на кнопку на риббоне, в crm2011, вызывает плагин в crm 4. Пытаюсь отправить soap запрос на assign, но что то не получается. Вообще, такое реально сделать? При нажатии на кнопку, он просит ввести данные от crm 2011. И в каком направлении копать лучше? Заранее всем спасибо!

Вот soap запрос:
X++:
var xml = '<?xml version="1.0" encoding="utf-8"?>' +
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">' +
     '<soap:Header>' + 
' <CrmAuthenticationToken xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">' + 
' <AuthenticationType xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">0</AuthenticationType>' + 
' <OrganizationName xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">crm4</OrganizationName>' + 
' <CallerId xmlns=\"http://schemas.microsoft.com/crm/2007/CoreTypes\">00000000-0000-0000-0000-000000000000</CallerId>' + 
' </CrmAuthenticationToken>' + 
' </soap:Header>' + 
   '<soap:Body>' +
     '<Execute xmlns="http://schemas.microsoft.com/crm/2007/WebServices">' +
        '<Request xsi:type="AssignRequest">' +
          '<Target xsi:type="TargetOwnedDynamic">' +
            '<EntityName>opportunity</EntityName>' +
'<EntityId>' + Xrm.Page.data.entity.getId() +'</EntityId>' 
           '</Target>' +
            '<Assignee>' +
               '<PrincipalId xmlns="http://schemas.microsoft.com/crm/2006/CoreTypes">' + Xrm.Page.data.entity.attributes.get("ownerid").getValue()[0].id +'</PrincipalId>' +
               '<Type xmlns="http://schemas.microsoft.com/crm/2006/CoreTypes">User</Type>' +
            '</Assignee>' +
        '</Request>' +
     '</Execute>' +
   '</soap:Body>' +
  '</soap:Envelope>';

    var xmlHttpRequest = new ActiveXObject('Msxml2.XMLHTTP');
    xmlHttpRequest.Open('POST', '/mscrmservices/2007/CrmService.asmx', false);
    xmlHttpRequest.setRequestHeader('SOAPAction', 'http://schemas.microsoft.com/crm/2007/WebServices/Execute');
    xmlHttpRequest.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
    xmlHttpRequest.setRequestHeader('Content-Length', xml.length);
    xmlHttpRequest.send(xml);
guid'ы ответственного и возможной сделки в обоих системах совпадают

Последний раз редактировалось Taker1796; 12.03.2013 в 16:24.