View Article

Configure a Validate Delete Constraint

By Xelence Documentation posted 09-01-2021 14:56

  

Introduction

Some data is crucial and should not be deleted. For example, you might want to disallow deleting a record that is in Valid status. To prevent the user from deleting such records, you must configure validate delete rules. These rules evaluate to either true or false; if evaluated to true, the application will not delete the record, and will display a message informing the user why.

Prerequisites

  • The HTML entity must exist.
  • The entity must be configured to allow the user to delete it.
Quick Steps
1 Search for and open the entity
2 Open the Conditions section, then open the Expression section
3 Create a new expression
4 Enter the Name, then click OK
5 Enter the expression details
6 Enter or select the message
7 Save the entity
8 Open the Constraints section, then open the Delete section
9 Add an expression
10 Enter the details, then click OK
11 Save the entity

Detailed Steps

Step 1. Search for and open the entity.

This is where you configure the validate delete constraint.


Step 2. Open the Conditions section, then open the Expression section.

Here, you can create an expression for a delete constraint.



Step 3. Create a new expression.

Click the plus icon to add an expression.



Step 4. Enter the Name, then click OK.

Give your expression a descriptive name. You will have lots of validations and you want to be able to identify each one at a glance.



Step 5. Enter the expression details.

Click the Add Condition button to create the expression.

Enter the expression. This prevents the system from deleting the object whenever it (the expression) evaluates to true.

The important properties are:

  • Query: Allows you to use queries in your expression.
  • Attribute: Allows you to enter the entity attribute.
  • Rule: Allows you to use rules in your expression.
  • Regx: Represents a pattern that can be selected to be matched in a search operation.
  • Condition: Allows you to compare an attribute to a value or set of values by using an operator.
Operators are In, NotIn, Like, Contains, Exists, Between, IsFalse, IsNull, IsTrue, IsNotNull, IsEqualTo, IsNotEqualTo, IsLessThan, IsLessThanorEqualTo, IsGreaterThan, and 
IsGreaterThanorEqualTo



Step 6. Enter or select the message.

If there is an existing message in the framework's messages table, you could enter its ID. If not already added, click the + icon to add a new message with newly generated message Id.



Step 7. Save the entity.

Click the icon to save the entity.



Step 8. Open the Constraints section, then open the Delete section.


Step 9. Add an expression.

Click the + icon to add the expression.



Step 10. Enter the details, then click OK.

Enter the details:

  • Condition (ID): Allows you to select a rule or expression from the entity.
  • Precondition (ID): Allows you to select the rule or expression that must be true before the condition is invoked.
  • Mode: Specifies the mode on which the constraint should be called; options are New, Update, or All.
  • Status: Specifies the status; options are Active or Inactive.

Whenever the system evaluates this expression to true, it will not allow the user to delete the record. On a form, it will display the error message, so the user knows it is a delete constraint message.



Step 11. Save the entity.

Click the icon to save the entity.


Then, run the Preview on the form with the delete functionality. Xelence displays the form output. You can test your updated settings.

When you have previewed your form, it should look something like this. If you try to delete a record the rule prevents deleting, your app displays an error.

The application should always display a confirmation when the user submits a delete request. Click OK.
The record is not deleted and the message you configured is displayed.



What are the improvements over S3 Version 6?

The expression now can be added using various options like Query, Attributes, Rule, Regx, Condition. This is done as part of process improvement.


Related Articles

Add an Expression

Add a Field Constraint


This post is part of the Entity topic. Click here to open the Entity Overview.

#Xelence
#Entity

0 comments
127 views