In this scenario we will demonstrate how to set up a ClientSide Decision Table that you can use to generate an Audit Record ServerSide as well as carry out ClientSide actions.
For this article it is assumed that you have at least basic familiarity with Decision Tables and/or have read the following articles:
Note: We will not detail step-by-step instructions here on how to set up Conditions or Actions, please read the above articles if you need detailed configuration steps.
For this sample we will are going trigger formulas on the Invoice if someone without the Sales Manager security role opens the form.
We have created a simple custom entity called an Audit Access Log that we will use to store the unauthorized access attempts.
The Business Rules
If someone opens an Invoice record without the Sales Manager Security Role
- Hide the Tabs on the Invoice
- Display a warning message
- Create an Audit Access Log record
N52 Formula Manager Solution
The Formula Manager solution works like this:
- A Decision Table of type 'ClientSide - Perform Action' is created on the Invoice entity
- The Source Property is set to the 'OnLoad' event
- The Event is set to 'Update'
- Exit on First Match is turned On (checked)
Note: By naming the Action columns as ClientSide the Decision Table understands that we want to execute a ClientSide formula here against the form rather than against a specific field. When we name a column as ServerSidethe Decision Table will execute that Action on the server instead of ClientSide. You can set the column name by right-clicking within the column to bring out the contextual menu, then select Set Action Column Options > Set ClientSide Action or Set ServerSide Action - see an example here.
This Decision Table uses a Calculation to check if the user has the Sales Manager security role:
If(IsUserInSecurityRoles(WhoAmI(), 'Sales Manager'), true, false )
CreateAuditRecord CreateRecord('new_auditaccesslog', SetAttribute('new_name', 'Invoice Access - ' + UtcDateTime()), SetAttributeLookup('new_user', 'systemuser' , WhoAmI()) )
Below is what a user without the Sales Manager Security Role will see:
The Audit Access Log record that was created when the user opened the Invoice
The Invoice when a user that has the Sales Manager security role opens the the Invoice