Example: Find Action

This topic describes sample inbound and outbound messages for the find action in Application Integration Framework (AIF). You can use the find action to obtain the values of all fields in the target table, for the records that match your query criteria.

The outbound message contains and <entityName> tag for each found record.

The following inbound Find message specifies one <CriteriaElement> tag. The Equal operator is used, and the <FieldName> value is the key field. Therefore, at most one record can be returned in the outbound message from the target table. Records from a child table could also be in the outbound message.

There are no XML tags that are specific to this inbound message. However, the value for <DataSourceName> is specific to this message, and it must be compatible with the service that is listed in the <Action> tag.

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns = "http://schemas.microsoft.com/
   dynamics/2008/01/documents/Message">
 <Header>
  <MessageId>{d1e4853a-0311-1233-0008
    -e84804976b33}</MessageId>
  <SourceEndpointUser></SourceEndpointUser>
  <SourceEndpoint></SourceEndpoint>
  <DestinationEndpoint></DestinationEndpoint>
  <Action>http://schemas.microsoft.com/dynamics/
    2008/01/services/CustomerService/find</Action>
 </Header>

 <Body>
  <MessageParts xmlns="http://schemas.microsoft.com/
    dynamics/2008/01/documents/Message">
   <QueryCriteria xmlns = "http://schemas.microsoft.com/
     dynamics/2006/02/documents/QueryCriteria">
    <CriteriaElement>
     <DataSourceName>CustTable</DataSourceName>
     <FieldName>AccountNum</FieldName>
     <Operator>Equal</Operator>
     <Value1>4507</Value1>
     <Value2/>
    </CriteriaElement>
   </QueryCriteria>
  </MessageParts>
 </Body>
</Envelope>

The outbound message contains a <serviceExternalName> tag, which is <Customer>. The message also contains an <entityName> tag named <CustTable>, which is for the record that was found in the target table. Nested underneath is another <entityName> tag for a child table, which is the <CustAddress> tag.

The following outbound message is generated from the previous inbound message.

<?xml version="1.0" encoding="utf-8"?>
<Envelope xmlns = "http://schemas.microsoft.com/
  dynamics/2008/01/documents/Message">
 <Header>
  <MessageId>{03264A2B-2A88-4BFB-8042-1383EE9A17BA}</MessageId>
  <SourceEndpoint>Default</SourceEndpoint>
  <DestinationEndpoint>Default</DestinationEndpoint>
  <Action>http://schemas.microsoft.com/dynamics/
    2008/01/services/CustomerService/find</Action>
  <RequestMessageId>{D1E4853A-0311-1233-0008
    -E84804976B33}</RequestMessageId>
 </Header>

 <Body>
  <MessageParts xmlns = "http://schemas.microsoft.com/
    dynamics/2008/01/documents/Message">

   <Customer xmlns = "http://schemas.microsoft.com/
     dynamics/2008/01/documents/Customer">
    <DocPurpose>Original</DocPurpose>
    <SenderId>DAT</SenderId>

    <CustTable class = "entity">
     <_DocumentHash>4b013b5bcf0114339596d2c7c43d0e3b</_DocumentHash>
     <AccountNum>4507</AccountNum>
     <AccountStatement>Always</AccountStatement>
     <Address>BBBn-4507 7212 9th Street
Fargo, ND 58102
US</Address>
     <Blocked>No</Blocked>
     <CashDisc>5D2%</CashDisc>
     <City>Fargo</City>
     <CountryRegionId>US</CountryRegionId>
     <County>Cass</County>
     <Currency>USD</Currency>
     <CustGroup>30</CustGroup>
     <ForecastDMPInclude>No</ForecastDMPInclude>
     <GiroType>None</GiroType>
     <GiroTypeCollectionletter>None</GiroTypeCollectionletter>
     <GiroTypeFreeTextInvoice>None</GiroTypeFreeTextInvoice>
     <GiroTypeInterestNote>None</GiroTypeInterestNote>
     <GiroTypeProjInvoice>None</GiroTypeProjInvoice>
     <InclTax>No</InclTax>
     <InterCompanyAllowIndirectCreation
       >No</InterCompanyAllowIndirectCreation>
     <InterCompanyAutoCreateOrders>No</InterCompanyAutoCreateOrders>
     <InterCompanyDirectDelivery>No</InterCompanyDirectDelivery>
     <InvoiceAddress>InvoiceAccount</InvoiceAddress>
     <LanguageId>en-us</LanguageId>
     <MandatoryCreditLimit>No</MandatoryCreditLimit>
     <Name>Northwind Traders</Name>
     <NameAlias>NW Traders</NameAlias>
     <OneTimeCustomer>No</OneTimeCustomer>
     <PartyId>1318</PartyId>
     <PartyType>Organization</PartyType>
     <PaymTermId>D30</PaymTermId>
     <RecId>5637144604</RecId>
     <RecVersion>1239343749</RecVersion>
     <RFIDCaseTagging>No</RFIDCaseTagging>
     <RFIDItemTagging>No</RFIDItemTagging>
     <RFIDPalletTagging>No</RFIDPalletTagging>
     <ShipCarrierBlindShipment>No</ShipCarrierBlindShipment>
     <ShipCarrierFuelSurcharge>No</ShipCarrierFuelSurcharge>
     <State>ND</State>
     <Street>BBBn-4507 7212 9th Street</Street>
     <WebSalesOrderDisplay>WebEntered</WebSalesOrderDisplay>
     <ZipCode>58102</ZipCode>

     <CustAddress class = "entity">
      <Address>BBBn-4507 111 5th Street
Baltimore, MD 21210
US</Address>
      <AddrRecId>5637144604</AddrRecId>
      <AddrTableId>77</AddrTableId>
      <City>Baltimore</City>
      <CountryRegionId>US</CountryRegionId>
      <County>Baltimore</County>
      <DlvMode>U11A</DlvMode>
      <DlvTerm>TERMNA3RD</DlvTerm>
      <Name>Jane Smith</Name>
      <RecId>5637145089</RecId>
      <RecVersion>1046119464</RecVersion>
      <ShipCarrierAccount>234-456</ShipCarrierAccount>
      <ShipCarrierAccountCode>UPS</ShipCarrierAccountCode>
      <ShipCarrierBlindShipment>No</ShipCarrierBlindShipment>
      <ShipCarrierID>U11A</ShipCarrierID>
      <ShipCarrierResidential>No</ShipCarrierResidential>
      <State>MD</State>
      <Street>BBBn-4507 111 5th Street</Street>
      <TimeZone xsi:nil = "true"
        xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance" />
      <type>ShipCarrierThirdPartyShipping</type>
      <ZipCode>21210</ZipCode>

     </CustAddress>
    </CustTable>
   </Customer>

  </MessageParts>
 </Body>
</Envelope>

Community Additions

ADD
Show: