A120 – Historize a business object

What you will learn ?

Historize a business object

STEP 1: Open the business object to historize

 

Prerequisites:

Having the business object with all its fields and rights.

  • Go to the object definition via the menu or via the object diagram
  • Extend the object form to see all properties
  • In the Options tab, put the Data history property to Yes
  • Save

Exercise:

  • Add historic to the AppClient object

STEP 2: Add the historic object to the diagram

If the historic object does not already exist, the platform will create it.

  • Generated name is Historic: it is important not to change it!
  • The name of the table will be the same as the main object suffix “_hist”
  • The historic object has its generated fields referenced to the father: reference, version, date, login
  • And all the attributes of the main object
  • And a read right function to grant

It is therefore possible to insert it in the diagram:

  • Right click on AppClient / Fetch related Business object
  • Or right click on the diagram Insert Business object and select the historical object

Exercise:

  • Insert the generated object AppClientHistoric in the object diagram
  • Save the diagram

STEP 3: Configure the historic object

You can configure the historical object like any other object:

  • Add function
  • Remove or add attributes, except those that deal with technical history:

row_ref_id: foreign key to the father row_idx: incremental version created_by_hist: user created_dt_hist: datetime

Exercise:

  • Change the translation by customer historic
  • Verify that the tab will be visible:
    In the object AppClient Link Tab open AppClientHistoric check that Visible panel is set to Yes.
    We could also hide by setting to no but keep the object to save historic data in table.

STEP 4: Add a function

You can create functions to give more access to the historic (default read-only).

Exercise:

  • Add a function to allow reading and deleting to the object AppClientHistoric

STEP 5: Grant function

Exercise:

  • Grant the function to MyAdminGroup group

STEP 6: Change default sorting

Exercise:

  • change the default sorting of the field row_idx to -2, in order that the data are ordered from newest to oldest.

STEP 7: Remove fields from historic object

Generally all the fields are not to “historize” then they should be remove from the object. Pay attention not to remove a field, you need only to delete the object field, not the field itself. If the field is removed, it will also be removed from the main object (as already seen, a field can belong to several objects, it is the case in the historic object).

Exercise:

  • Remove the object field related to the customer name in AppClientHistoric. This means that any change of name will not be historized.

STEP 8: Clear cache

Clear the cache in order to view the configuration of historic object.

STEP 9: Test

Exercise:

  • Create and modify a customer
  • Make different updates, name, address or status change
  • Verify that the updates are in customer historic tab

STEP 10: Clear cache

To enable action on the object, clear the cache of the platform.

STEP 11: Test the action

Open the object containing the action and check that it performs well what is set.

Exercise:

  • Open a customer who has interests
  • Check that the total calculation works by clicking on the button Calculate score
    If action is not visible is that the user is not in a group granted to the function of the action.
    If the calculation does not work, look out for the logs and fix the code.
    Remember to clear the cache at each update.

A110 – Create a specific action

How to add a specific action on a business object.

A130 – Create linked list

How to create lists of dependent values to another list of values.