11.04.2012, 15:18 | #1 |
Участник
|
Close Opportunity
Добрые день, коллеги. Не пишется значение в поле actualrevenue во время закрытия OpportunityClose в CRM 2011
Запрос вот Код: var requestMain = ""; requestMain += "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">"; requestMain += " <s:Body>"; requestMain += " <Execute xmlns=\"http://schemas.microsoft.com/xrm/2011/Contracts/Services\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">"; requestMain += " <request i:type=\"b:WinOpportunityRequest\" xmlns:a=\"http://schemas.microsoft.com/xrm/2011/Contracts\" xmlns:b=\"http://schemas.microsoft.com/crm/2011/Contracts\">"; requestMain += " <a:Parameters xmlns:c=\"http://schemas.datacontract.org/2004/07/System.Collections.Generic\">"; requestMain += " <a:KeyValuePairOfstringanyType>"; requestMain += " <c:key>OpportunityClose</c:key>"; requestMain += " <c:value i:type=\"a:Entity\">"; requestMain += " <a:Attributes>"; requestMain += " <a:KeyValuePairOfstringanyType>"; requestMain += " <c:key>opportunityid</c:key>"; requestMain += " <c:value i:type=\"a:EntityReference\">"; requestMain += " <a:Id>" + opportunityid + "</a:Id>"; requestMain += " <a:LogicalName>opportunity</a:LogicalName>"; requestMain += " <a:Name i:nil=\"true\" />"; requestMain += " </c:value>"; requestMain += " </a:KeyValuePairOfstringanyType>"; requestMain += " <a:KeyValuePairOfstringanyType>"; requestMain += " <c:key>subject</c:key>"; requestMain += " <c:value i:type=\"d:string\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">" + subject + "</c:value>"; requestMain += " </a:KeyValuePairOfstringanyType>"; requestMain += " <a:KeyValuePairOfstringanyType>"; requestMain += " <c:key>description</c:key>"; requestMain += " <c:value i:type=\"d:string\" xmlns:d=\"http://www.w3.org/2001/XMLSchema\">" + desctiption + "</c:value>"; requestMain += " </a:KeyValuePairOfstringanyType>"; requestMain += " <a:KeyValuePairOfstringanyType>"; requestMain += " <c:key>actualend</c:key>"; requestMain += " <c:value i:type=\"g:dateTime\" xmlns:g=\"http://www.w3.org/2001/XMLSchema\">" + actualend.format("isoUtcDateTime") + "</c:value>"; requestMain += " </a:KeyValuePairOfstringanyType>"; requestMain += " <a:KeyValuePairOfstringanyType>"; requestMain += " <c:key>actualrevenue</c:key>"; requestMain += " <c:value i:type=\"e:decimal\" xmlns:e=\"http://www.w3.org/2001/XMLSchema\">123.00</c:value>"; requestMain += " </a:KeyValuePairOfstringanyType>"; requestMain += " </a:Attributes>"; requestMain += " <a:EntityState i:nil=\"true\" />"; requestMain += " <a:FormattedValues />"; requestMain += " <a:Id>00000000-0000-0000-0000-000000000000</a:Id>"; requestMain += " <a:LogicalName>opportunityclose</a:LogicalName>"; requestMain += " <a:RelatedEntities />"; requestMain += " </c:value>"; requestMain += " </a:KeyValuePairOfstringanyType>"; requestMain += " <a:KeyValuePairOfstringanyType>"; requestMain += " <c:key>Status</c:key>"; requestMain += " <c:value i:type=\"a:OptionSetValue\">"; requestMain += " <a:Value>" + status + "</a:Value>"; requestMain += " </c:value>"; requestMain += " </a:KeyValuePairOfstringanyType>"; requestMain += " </a:Parameters>"; requestMain += " <a:RequestId i:nil=\"true\" />"; requestMain += " <a:RequestName>WinOpportunity</a:RequestName>"; requestMain += " </request>"; requestMain += " </Execute>"; requestMain += " </s:Body>"; requestMain += "</s:Envelope>"; var req = new XMLHttpRequest(); Цифирка 123.00 вбита руками для теста и она никак не сохраняется. НИГДЕ не нашел примера чтобы писалось знаение Money в поле. Может я не корректно тип данных пишу, но я уже все возможные перепробовал. Что делать? |
|
11.04.2012, 15:50 | #2 |
Участник
|
Выполнил следующий код
X++: Entity entity = new Entity("test"); entity["moneyfield"] = new Money(new Decimal(123)); DataContractSerializer serializer = new DataContractSerializer(typeof(Entity), "entity", @"http://schemas.microsoft.com/xrm/2011/Contracts/Services"); MemoryStream ms = new MemoryStream(); StringWriter sw = new StringWriter(); using (XmlTextWriter writer = new XmlTextWriter(sw)) { writer.Formatting = Formatting.Indented; serializer.WriteObject(writer, entity); } string aaa = sw.ToString(); X++: <entity xmlns:d1p1="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services"> <d1p1:Attributes xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic"> <d1p1:KeyValuePairOfstringanyType> <d2p1:key>moneyfield</d2p1:key> <d2p1:value i:type="d1p1:Money"> <d1p1:Value>123</d1p1:Value> </d2p1:value> </d1p1:KeyValuePairOfstringanyType> </d1p1:Attributes> <d1p1:EntityState i:nil="true" /> <d1p1:FormattedValues xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /> <d1p1:Id>00000000-0000-0000-0000-000000000000</d1p1:Id> <d1p1:LogicalName>test</d1p1:LogicalName> <d1p1:RelatedEntities xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" /> </entity> это Вам поможет. X++: <d1p1:KeyValuePairOfstringanyType>
<d2p1:key>moneyfield</d2p1:key>
<d2p1:value i:type="d1p1:Money">
<d1p1:Value>123</d1p1:Value>
</d2p1:value>
</d1p1:KeyValuePairOfstringanyType> Последний раз редактировалось g.Naukovych; 11.04.2012 в 15:55. |
|
|
За это сообщение автора поблагодарили: Kipetcoff (1). |
11.04.2012, 16:15 | #3 |
Участник
|
Да, так работает!
|
|
|
|