View Article

Make a Form Read-Only Based on a Business Rule

By Xelence Documentation posted 03-07-2022 14:52

  

Introduction

Under normal circumstances, every time the user navigates to a maintenance form, that form is editable, whether the user is creating a new record or updating an existing one. However, you may have a business need to change a form to read-only so that the user cannot change the data or save any changes.

To make a form read-only, you can create a rule defining the conditions you want to prevent the user from editing the form, then enter that rule as the ReadOnly Rule on the form's entity.

Prerequisites

  • The entity must exist.
  • The maintenance form must exist.
Quick Steps
1 Search for and open the entity
2 Open the Conditions section, then open the Rule section
3 Add a rule
4 Enter the details, then click OK
5 Design the rule's expression
6 Compile the rule, then save the rule
7 Open the Configuration tab
8 Enter the ReadOnly Rule in the Other Details panel
9 Save the entity

Detailed Steps

Step 1. Search for and open the entity.

The form's entity is where you configure its conditions.



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

This is where you are going to configure the read-only rule.


Step 3. Add a rule.

Click the plus icon to add a rule.




Step 4. Enter the details, then click OK.

Enter the details:

  • Name(ID): Give your rule a descriptive name to make it easy to work with in future.
  • Access Modifier: Specifies the level of accessibility of the rule.
Access options are "Public", "Private", and "Protected". Public means any entity can access the rule. Private means only this entity can access this rule. Protected means only 
this entity and any child entity can access this rule.



Step 5. Design the rule's expression.

Design a condition rule. Whenever it evaluates to true, the form  becomes read-only and prevents the application from saving data.



Step 6. Compile the rule, then save the rule.

 



Step 7. Open the Configuration tab.



Step 8. Enter the ReadOnly Rule in the Other Details panel.

This rule comes from the entity. You must define it there before you can use it here.



Step 9. Save the entity.


Now any form that uses this entity will become read-only if the rule evaluates to true.














In the example above, the Designation is the Sales Representative (SR), so the rule condition is met, and the record is read-only. The Save button no longer displays. Instead, the screen displays a message informing the user the record is read-only, plus the rule that made it read-only. This is why the rule's name should be as descriptive as possible.


What are the improvements over S3 Version 6?

Previously, the validation rule expression was added in the initial load section and then it was added as a read only rule in Business Object Details section of the Entity details. There are more condition options available now, i.e. either by expression or rules. And multiple and complex conditions can be added.



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


#Xelence

#Forms

0 comments
139 views