Employee Data and saving changes

Hi, 

I am creating an employee application. I have an employee CDT. One of the requirements is to save employee data changes and have a history of the changes. 

An idea to do this is to save a new employee in the CDT each time a change is made. I don't think this is a good idea, could you list out all the reasons why this is not a good idea? 

A suggested solution would be ideal too. I'm thinking a separate audit CDT is best to save the changes and who made the changes. 

Many thanks, 

Eric

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer
    Hi Eric,

    My suggestion would be to have a main Employee CDT, as you suggest, as well as an Audit CDT. Any update to the employee should overwrite the Employee CDT, so that querying the Employee table will return the most up-to-date employee. You can also save any change to the employee to the Audit table (and have a foreign key to the employee), so that you can query the Audit table for a single employee (foreign key), and return a history of all action taken on that employee.

    Hope this helps.
  • Hello eric,

    You can do it with a CDT as Evan mentioned. Another Idea If you create a Quick app you will see how they create the Audit history, it is everything handled in Appian as well.

    I personally like the following pattern unless you require something more complex than recording the values changes.
    In SQL we have the triggers (on update) which help us to verify when certain value is changed from there you will have the reference of the old.field and new.field values and if something changed you just insert to your audit log.

    Depending on how much information you want to have in your audit log you might need to pass it to the employee table, the code to do that is simpler.

    Jose