Tuesday, 3 February 2015

Microsoft Dynamics CRM GenerateSalesOrderFromOpportunityRequest from PHP with XML



Hi I have a php based system which interacts with Microsoft Dynamics CRM. Most of the interactions are handled using the crmsoap api.


I am currently trying to use the function GenerateSalesOrderFromOpportunityRequest which takes an opportunity and creates an order from it (yay for literal titles).


Unfortunatly the crmsoap api is a couple of versions behind CRM itself and it does not actually have the ability to use this function.


I have been trying to find and example of the XML I need but have been struggling. Does anyone have a working example of the XML?


Or can anyone see what I am doing wrong? This is what I have so far:





$retxml = $this->call(
'Execute',
'<request i:type="b:GenerateSalesOrderFromOpportunityRequest" xmlns:a="http://ift.tt/1fKiNqh" xmlns:b="http://ift.tt/1fKiLPj">' .
'<a:Parameters xmlns:c="http://ift.tt/191j4n0">' .
'<a:KeyValuePairOfstringanyType>' .
'<c:key>OpportunityId</c:key>' .
'<c:value i:type="d:guid" xmlns:d="http://ift.tt/JiuCsN">' . $opportunityid . '</c:value>' .
'</a:KeyValuePairOfstringanyType>' .
'<a:KeyValuePairOfstringanyType>' .
'<c:key>ColumnSet</c:key>' .
'<c:value i:type="a:ColumnSet">' .
'<a:AllColumns>true</a:AllColumns>' .
'<a:Columns xmlns:d="http://ift.tt/1bQEByM" />' .
'</c:value>' .
'</a:KeyValuePairOfstringanyType>' .
'</a:Parameters>' .
'<a:RequestId i:nil="true" />' .
'<a:RequestName>GenerateSalesOrderFromOpportunity</a:RequestName>' .
'</request>'
);

<!-- begin snippet: js hide: false -->



This is the XML from the WSDL:





<s:complexType name="GenerateSalesOrderFromOpportunityRequest">
<s:complexContent mixed="false">
<s:extension base="tns:Request">
<s:sequence>
<s:element name="OpportunityId" type="s0:guid" />
<s:element name="ColumnSet" type="s3:ColumnSetBase" />
</s:sequence>
<s:attribute name="ReturnDynamicEntities" type="s:boolean" use="required" />
</s:extension>
</s:complexContent>
</s:complexType>
<s:complexType name="GenerateSalesOrderFromOpportunityResponse">
<s:complexContent mixed="false">
<s:extension base="tns:Response">
<s:sequence>
<s:element ref="s4:BusinessEntity" />
</s:sequence>
</s:extension>
</s:complexContent>
</s:complexType>



No comments:

Post a Comment