Import the Order Valid events

1. Create the mapping for Order Valid events

To bring the Order Valid events into your application, define the mapping for the Order Valid events. To do so, first create these two new attributes on the Order entity:

  • Total amounts
  • Line items


Attributes and Event Types


When you process an Order Valid event, that processing modifies the relation between an order instance and a step instance. 

Based on the table above, to process Order Valid events, you must:

  • Add the total Amount value.

  • Add the item Count value.

Step

Action

1

On the left menu, click Mappings.

2 Select the mapOrder mapping and click the Copy icon.
3

Click the Copy button.

4 Name the new mapping map Valid .

You are updating instances of Order, not creating them. This means you do not need to pass Customer Name or Reference or set the relation Global. All you need to do is:

  • Resolve the instance with the order Number parameter (same as the current mapping)

  • Update the time with the Timestamp parameter (same as the current mapping)

  • Update the relation to the Step parameter (same as the current mapping)

  • Map the values for line items and total amount.

Step Action
1

Delete the unneeded parameters.

2 Add parameter for line items (integer) and total amount (decimal).
3

In the Operations area, remove the set value sections for customer Name, customer Reference, and Global.

4

Add an operation to change the values of the line items and total amount attributes.

5

Click Save,

6

Click the a routing context hyperlink and copy the information for the two new attributes.


2. Update the route for Order Valid events

You are creating separate mapping instances for each event, but you can reference the mappings from the same route.

Step

Action


On the left menu, click Routes, then select the rouOrder route.

2

In the u:map create statement, paste in the routing context you just copied from the mapValid mapping.  

3

Modify the ${body} line for each new map entry that you've pasted so they reference the correct column number in your import file.

4

Add a new section to send information to the rouOrder route when the Step name is Order Valid. This section can follow just after the one that sends information to the rouOrder route for New Order events. There is an example of these statements in the figure below. Note the changes to the log messages.

5

Best practice reminder: comment out the to uri statements until you have run the route and reviewed the logs.


Save the route and run it using the Spint-4-10-Orders.txt file. If your logs look like the picture below, move on to the next step.


6

When everything looks correct, remove the commented-out calls to the mappings, save and run the route.

7

To check your results, navigate to the Search for Orders dashboard. All 10 orders should be visible in the selected orders pagelet and all of them should be shown as being in the Order Valid step.

3. Add attributes to the Search for orders dashboard

The Order Valid events add the new data fields for Total Amount and Line Items. It is time to update your search dashboard to match.

Step

Action

1

Open your Search for Orders dashboard in edit mode, then click on the pencil for Selected Orders.

2 Edit the selected orders pagelet.
3

Click the Add value button. Add the line Items.

4

Click the Add value button. Add the total amount. Change the label to Total Amount.

5

Click Done to save the changes to your pagelet.

6

Edit the Orders Closed Today pagelet to add Line Items and Total Amount.

7

Do not add Current Step in this pagelet – because the order is complete so there is no current step.

8

When the display looks good to you, click Done and Save.

9

Change the time machine setting to June 1 at 11:45am.

10

Your dashboard should look something like this:

Related Links