Extended actions

Each <Step> element in an import mapping file can have one or more <ExtendedAction> elements as children. Extended actions can be used to extend the functionality of Data Management by calling methods. These will often be methods of Infor Public Sector business objects, but you can also call methods of agency objects, or any other object to which you can assign a variable ID. You can thus perform operations that go beyond adding, updating, and deleting.

To add an extended action, you must specify the object you want to work with and the method you want to call. The object is identified by a variable ID, so you must first set the variable ID. For example, if you want to call a method of the ServiceRequest object, you will need a step with ServiceRequest as its target business object and a VariableId attribute, as shown below.

<Step Id="1" 
 TargetBusinessObject="Hansen.CRM.ServiceRequest" 
 Action="Create, Update" VariableId="SR">

So the example above assigns the variable ID SR to the ServiceRequest object. In the <ExtendedAction> element, the business object is specified by the VariableId element, and the method to call is specified by the TargetOperation attribute. In the example below, the extended action will call the CalculateDueDates method of the ServiceRequest object.

<ExtendedAction VariableId="SR" 
 TargetOperation="CalculateDueDates" />

If the method called by the extended action takes parameters, the parameters will be elements. There are three types of parameter elements: <Parameter>, <VariableParameter>, and <SelfParameter>.

A <Parameter> element specifies the value and type of the parameter. For example, the ServiceRequest object has a SendMail method that sends email to each address in the mailing list, as defined for the service request type. The method has one parameter, an integer that defines the condition for the email. For example, a value of 1 indicates that the mail will be sent to each contact who has requested to be notified when a new service request is added. The example below calls the SendMail method and uses a <Parameter> element to set the parameter.

<ExtendedAction VariableId="SR" TargetOperation="SendMail" />
   <Parameter Value="1" Type="System.Int32" />
</ExtendedAction>

A <VariableParameter> element uses a selected variable, set elsewhere in the mapping file, as the method parameter. For example, the ServiceRequest object has a SetPrimaryCall method that makes the specified customer call the primary call for the service request. The method takes a CustomerCall object as its parameter. Assuming that the variable ID CustCall is assigned to the Hansen.CRM.CustomerCall object elsewhere in the mapping file, you can use that variable as the method’s parameter, as shown below.

<ExtendedAction 
 VariableId="SR" TargetOperation="SetPrimaryCall" />
   <VariableParameter VariableId="CustCall" />
</ExtendedAction>

Finally, a <SelfParameter> element uses the step’s target business object itself as the parameter. The example below shows the SetPrimaryCall method again. Because the step has Hansen.CRM.CustomerCall as its target business object, you can use a <SelfParameter> element to set the parameter, rather than the <VariableParameter> as in the previous example.

<Step Id="3" 
 TargetBusinessObject="Hansen.CRM.CustomerCall" 
 Action="Create, Update">
   ...
   <ExtendedAction VariableId="SR" TargetOperation="SetPrimaryCall" />
      <SelfParameter />
   </ExtendedAction>

If you want to drill down to a child business object, you can add a Target attribute to the <ExtendedAction> element. The value of the Target attribute should be a property of the business object identified by the VariableId. For example, the ServiceRequest object has a CustomerCalls property that you can use to drill down to the collection of calls associated with the service request.

<ExtendedAction VariableId="SR" 
 Target="CustomerCalls" TargetOperation="" />

Note that the TargetOperation attribute here is empty. This attribute is usually required, but if the object the extended action works on is a collection that implements the IList interface, the .Add method is used by default.