15.10.2007, 17:38 | #8 |
Участник
|
В таком случае, нужно использовать разные прайс листы.
Согласен, что это менее удобно, чем все писать в карточке продукта, но зато "правильно" с точки зрения "идиологии" CRMа. Ведь не продукты задают цены (для заказов и и т.д.), а прайс листы. Просто из опыта хочу сказать, что лучше стараться не отходить от той "идиологии", что уже есть в CRMе. Сейчас может казаться, что ваш вариант удобнее и быстрее, но на следующих этапах проекта это может всплыть и будет очень неприятно все переделывать. Ну, а на случай если всё-таки не убедил, вот скрипт Код: function GetAttributeValueByEntityId(entityName, entytiId, attributeName) { var xml = '' + '[?xml version=`1.0` encoding=`utf-8`?]' + '\r\n' + '[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`]' + '\r\n' + ' [soap:Body]' + '\r\n' + ' [entityName xmlns=`http://schemas.microsoft.com/crm/2006/WebServices`]' + entityName + '[/entityName]' + '\r\n' + ' [id xmlns=`http://schemas.microsoft.com/crm/2006/WebServices`]' + entytiId + '[/id]' + '\r\n' + ' [columnSet xmlns=`http://schemas.microsoft.com/crm/2006/WebServices` xmlns:q=`http://schemas.microsoft.com/crm/2006/Query` xsi:type=`q:ColumnSet`]' + '\r\n' + ' [q:Attributes]' + '\r\n' + ' [q:Attribute]' + attributeName + '[/q:Attribute]' + '\r\n' + ' [/q:Attributes]' + '\r\n' + ' [/columnSet]' + '\r\n' + ' [/soap:Body]' + '\r\n' + '[/soap:Envelope]' + ''; xml = xml.replace(/\[/gi, String.fromCharCode(60)); xml = xml.replace(/\]/gi, String.fromCharCode(62)); xml = xml.replace(/\`/gi, String.fromCharCode(34)); var xmlHttpRequest = new ActiveXObject('Msxml2.XMLHTTP'); xmlHttpRequest.Open('POST', '/mscrmservices/2006/CrmService.asmx', false); xmlHttpRequest.setRequestHeader('SOAPAction','http://schemas.microsoft.com/crm/2006/WebServices/Retrieve'); xmlHttpRequest.setRequestHeader('Content-Type', 'text/xml; charset=utf-8'); xmlHttpRequest.setRequestHeader('Content-Length', xml.length); xmlHttpRequest.send(xml); var doc = xmlHttpRequest.responseXML; // alert(xmlHttpRequest.responseText); var retValue = ''; if (doc.selectSingleNode('//RetrieveResult/' + attributeName) != null) retValue = doc.selectSingleNode('//RetrieveResult/' + attributeName).text; return retValue; } Код: var oProduct = crmForm.all.productid; if (oProduct.DataValue != null && oProduct.DataValue[0] != null) { crmForm.all.SOME_OTHER_FIELD.DataValue = GetAttributeValueByEntityId('product', oProduct.DataValue[0].id, 'PRODUCT_ATTRIBUTE_NAME'); } |
|
|
За это сообщение автора поблагодарили: zhenek (1), Bondonello (1), mistah (1). |