Process Inbound User Area hook

Use this hook to execute additional actions when the BOD or BDE is processed. Examples:

  • Update another table based on fields in the UserArea
  • Update the linked tables with results of expressions
  • The inbound processing is based on the presence of the UserArea but is not limited to fields in the UserArea.
  • This processing of the UserArea is executed when the BOD or BDE component is completely processed by the BOD or BDE handler. The standard fields and the fields of the UserArea that are mapped to fields of the linked tables are processed already. The database records are updated, although not committed yet. To update the linked tables, select the current record again before updating the fields.

The lines of code in this hook are included in the function that the runtime BOD or BDE processor calls to process the UserArea. The structure of this generated function is:

function extern long process.inbound.user.area(
                const   string   i.component,
                        long     i.xml)
{
        ...
        on case i.component
        case "component1":
             |* Hook code for Process Inbound User Area for component1
             break
        case "component2":
             |* Hook code for Process Inbound User Area for component2
             break
        default:
             break
        endcase
        ...
        return(0)
}

You can report errors by calling function dal.set.error.message() and do an early return(DALHOOKERROR).

In the Process Inbound User Area hook you can use these macros to find the fields and their values in the UserArea:

  • getFirstProperty
  • getNextProperty
  • getNrProperties
  • getPropertyNr
  • getNamedProperty
  • getPropertyName
  • getPropertyType
  • getPropertyValue
  • getAccountingEntity
  • getCurrencyID
  • getListID
  • getNounName
  • getUnitCode
  • getDescription
  • getStartDateTime
  • getEndDateTime
  • getUserAreaParent
Note: Those macros only work in the hook itself. You cannot use them in a function you call from the hook. There are basically three ways to process the properties in the UserArea:
  • Get the required properties by their names with getNamedProperty()
  • Get the number of properties with getNrProperties() and process them one by one with getPropertyNr()
  • Get the first property with getFirstProperty() and the next ones with getNextProperty()

The examples used in the descriptions of the macros assume a UserArea in the PersonInBOD with this content:

<UserArea>
  <Property>
      <NameValue name="salary" type="AmountType" 
                 currencyID="USD">43000</NameValue>
      <EffectiveTimePeriod>
          <StartDateTime>2017-07-21T06:05:13Z</StartDateTime>
          <EndDateTime>2017-08-20T23:59:59Z</EndDateTime>
      </EffectiveTimePeriod>
  </Property>
  <Property>
      <NameValue name="oldWorkCenter" 
                 type="MasterDataReferenceType" 
                 nounName="WorkCenter" 
                 accountingEntity="AE1000">WC1</NameValue>
  </Property>
  <Property>
      <NameValue name="country" type="CodeType" 
                 listID="Countries" 
                 accountingEntity="AE1000">US</NameValue>
      <Description>United States</Description>
  </Property>
  <Property>
      <NameValue name="skill_01" type="StringType">S00</NameValue>
  </Property>
  <Property>
      <NameValue name="skill_02" type="StringType">S01</NameValue>
  </Property>
  <Property>
      <NameValue name="skill_03" type="StringType">S02</NameValue>
  </Property>
  <Property>
      <NameValue name="contract" type="QuantityType" 
                 unitCode="hrs">40</NameValue>
  </Property>
 </UserArea>