Select and Lookup

This example shows a service request as it might be represented in a data import file.

<ServiceRequest>
   <ID>1000</ID>
   <ServiceRequestType>Initial Read</ServiceRequestType>
   <RequestLocation>
      <Address>
         <Key>1000</Key>
      </Address>
   </RequestLocation>
   <CallInformation>
      <IncidentDate>2017-03-07T16:11:01</IncidentDate>
      <TakenBy>80000</TakenBy>
   </CallInformation>
</ServiceRequest>

The data to be imported includes the service request type. However, the import file uses the request type code to identify the request type, while the ServiceRequest object in Infor Public Sector uses the request type key. To add the service request, the mapping file must first look up the correct request type key.

The Select step that looks up the request type key is shown below. In this case the TargetBusinessObject attribute specifies the object to be queried, rather than the object to be added or updated. Similarly, the mappings serve as search criteria. So the step below will first search for an existing service request type whose RequestType property matches the value of the <ServiceRequestType> node in the import file. The request type key is then mapped to an output called REQTYPE.

<Step Id="99" 
 TargetBusinessObject="Hansen.CRM.ServiceRequestType" 
 Action="Select">
   <Outputs>
      <Output Id="REQTYPE" Source="RequestTypeKey" />
   </Outputs>
   <Mappings>
      <Map Source="ServiceRequestType" Target="RequestType"/>
   </Mappings>
</Step>

The next step adds the service request, using the REQTYPE output from the previous step as an input.

<Step Id="100" \
 TargetBusinessObject="Hansen.CRM.ServiceRequest" 
 Action="Create, Update" UpdateCheck="ServiceRequestNumber">
   <Inputs>
      <Input VariableId="REQTYPE" Target="RequestType.RequestTypeKey" />
   </Inputs>
   <Mappings>
      <Map Source="ID" Target="ServiceRequestNumber" />
      <Map Source="CallInformation/TakenBy" Target="TakenBY.EmployeeID" />
   </Mappings>
</Step>