Social Icons

Monday, August 12, 2013

Restrict users from creating or deleting records on a form

We had created a new function for the Lookup form in a previous article. On that function we had restricted the user from viewing any other lookup on the function definition itself.
There are 2 main disadvantages from the point of view of application support
  • The users are still free to create new lookups from this function even though they are unable to view those created records.
  • The users can delete the lookup by mistake.
To handle these scenarios we need to personalize this form. Here are the personalization steps
Open the form.
Notice that the Create New record icon,, and the Delete record icon, , are enabled. We need to disable these buttons. Also, the user can update the Meaning and Description fields as the fields are enabled for editing. We need to prevent the user from updating the data as well. The detail section of the form, i.e. the portion where the lookup values are entered, will be kept untouched so that the users can add/modify/delete any values as this is part of the maintenance process and this is the reason the form will be made available to them.
Logic for personalization
We shall personalize only the header section of the form so that the user is unable to Insert/Update/Delete on that section. This means the personalization will be based on the block named, FND_LOOKUP_TYPES. We would tend to think that the personalization can be done directly on the trigger, WHEN-NEW-FORM-INSTANCE, but it will not work. It is because the form function is defined to not only open the form but to query for the Lookup, XX_RESTRICTED_LOOKUP, as well. The user gets the control on the form after the form has queried the data for him.
We need to design the personalization from the point the user starts using the form. Since the form queries the data for the user we have designed the personalization on WHEN-NEW-RECORD-TRIGGER as this trigger will override the WHEN-NEW-FORM-INSTANCE trigger.
Personalization steps
Click on Help > Diagnostics > Custom Code > Personalize. The Personalization form will open.
Create a new personalization by entering the following,
Seq: 10
Description: Do not allow user to create a record
Level: Function
Condition tab
Trigger Event: WHEN-NEW-BLOCK-INSTANCE
Trigger Object: FND_LOOKUP_TYPES
Processing Mode: Both
Actions Tab
The following action is to prevent the user from creating a new lookup type.
Seq: 10
Type: Property
Description: Disable Create New Record
Language: All
Enabled: Checked
Object Type: Block
Target Object: FND_LOOKUP_TYPES
Property Name: INSERT_ALLOWED
Value: FALSE
The following action is to prevent the user from deleting the current lookup type.
Seq: 20
Type: Property
Description: Disable Delete Record
Language: All
Enabled: Checked
Object Type: Block
Target Object: FND_LOOKUP_TYPES
Property Name: DELETE_ALLOWED
Value: FALSE
The following action is to prevent the user from updating the lookup type.
Seq: 30
Type: Property
Description: Disable Updation of record
Language: All
Enabled: Checked
Object Type: Block
Target Object: FND_LOOKUP_TYPES
Property Name: UPDATE_ALLOWED
Value: FALSE
The actions tab looks like the following,
Save the form and close it.
Test the personalization
Close the Lookup form and open it again.
Now the header section of the form is completely disabled. Hence the user will be unable to update any of the fields. Also the Create New Record button/icon,, is disabled along with the Delete Record button/icon, .

No comments :

Post a Comment

">