Create and Update Operation Samples

The following is an example of a Create request document:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<crm:account.Create schemaVersion="1.0" xmlns:crm="urn:iwaysoftware:adapter:MSCRM2011:account:Create" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <crm:EntityList>
      <crm:Entity>
         <crm:Params>
            <crm:address1_telephone1>123456789</crm:address1_telephone1>                 
            <crm:name>account1</crm:name>
            <crm:numberofemployees>1234</crm:numberofemployees>
         </crm:Params>
      </crm:Entity>
  </crm:EntityList>
</crm:account.Create>

It contains the requested action, the entity to be created, and the parameters of the new entity. The entity identifier is a required parameter. A value must be specified, which is used by MS CRM to create an entity with a specified GUID. The following is an example of the response document for a successful Create operation:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<crm:account.Create.Response schemaVersion="1.0" xmlns:crm="urn:iwaysoftware:adapter:MSCRM2011:account:Create.Response" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <crm:EntityList>
      <crm:Entity>
         <crm:CreateResult>7B9520AD-AB21-E111-B7A6-005056887347</crm:CreateResult>
         <crm:Status>Success</crm:Status>
      </crm:Entity>
   </crm:EntityList>
</crm:account.Create.Response>

Information about the performed operation, entity, and the GUID of the created entity is returned.

The following is an example of an Update request:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<crm:account.Update schemaVersion="1.0" xmlns:crm="urn:iwaysoftware:adapter:MSCRM2011:account:Update" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <crm:EntityList>
      <crm:Entity>
         <crm:Params>
            <crm:accountid>7B9520AD-AB21-E111-B7A6-005056887347</crm:accountid>     
            <crm:address1_telephone1>123456789</crm:address1_telephone1>      
            <crm:name>updated_account</crm:name>
            <crm:numberofemployees>367184873</crm:numberofemployees>
         </crm:Params>
      </crm:Entity>
   </crm:EntityList>
</crm:account.Update>

It contains the requested action, the entity to be updated, the identifier of the entity to update, and a set of new parameters. The entity identifier must always be present in the request because MS CRM defines by identifier which entity to update. Parameters which are not specified in the input message will not be affected.

The following is an example of a successful response:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<crm:account.Update.Response schemaVersion="1.0" xmlns:crm="urn:iwaysoftware:adapter:MSCRM2011:account:Update.Response" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <crm:EntityList>
      <crm:Entity>
         <crm:Status>Success</crm:Status>
      </crm:Entity>
   </crm:EntityList>
</crm:account.Update.Response>

Information about the executed operation and updated entity is returned.

The following XML must be used in order to read a single entity object by its GUID.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<crm:account.Retrieve schemaVersion="1.0" xmlns:crm="urn:iwaysoftware:adapter:MSCRM2011:account:Retrieve" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <crm:EntityList>
      <crm:Entity>
         <crm:Params>
            <crm:Id>7B9520AD-AB21-E111-B7A6-005056887347</crm:Id>
         </crm:Params>
      </crm:Entity>
   </crm:EntityList>
</crm:account.Retrieve>

It contains the requested action, entity to be updated, the identifier of the entity to Read.

The following is an example of a response document that contains standard tags with operations, entity names, and a set of attributes.

<?xml version="1.0" encoding="ISO-8859-1" ?>
<crm:account.Retrieve.Response schemaVersion="1.0" xmlns:crm="urn:iwaysoftware:adapter:MSCRM2011:account:Retrieve.Response" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <crm:EntityList>
      <crm:Entity>
         <crm:Params>
            <crm:accountid>7B9520AD-AB21-E111-B7A6-005056887347</crm:accountid>
            <crm:address1_telephone1>123456789</crm:address1_telephone1>           
            <crm:name> updated_account </crm:name>
            <crm:numberofemployees formattedValue="367,184,873">367184873</crm:numberofemployees>
         </crm:Params>
         <crm:Status>Success</crm:Status>
      </crm:Entity>
   </crm:EntityList>
</crm:account.Retrieve.Response>

The request and response for Delete are the same for Retrieve operations except the action name and namespace URL.

For Create and Update operations, you can specify related entities which must be created or updated along with the main entity. For example, MS CRM can create an account and several letters for that account in one request. There is a special element named RelatedEntities in the request for this purpose. Since a related entity can be almost anything (for the account, it can be email, letter, contact, or other entity types), iWay Application Adapter for Microsoft Dynamics CRM 2011 On-Premises does not list parameters for related entities and defines the content of the related entities as any element. To get real attributes applicable for a certain related entity, the entity must be a schema.


iWay Software