September 20, 2018

Action Checks

If you have custom manager layout and want to perform some validations before data is saved to the DB, you can use this feature.

Example scenario: Develop a custom manager layout for entering PO details where user can either select pre-existing location as destination location or can enter complete address details like address line1, zip code etc using custom attributes.

In this custom screen, if we want to make sure that user either enters Destination Location XID or Enter new Destination location details with address details for the destination address.

For this scenario, we need  to make a custom validation checking that if Destination Location XID is entered or not, if this is not entered then check the custom attribute fields used to create location address lines etc. If both the details are missing, only then show a error message to user.

For this requirement we do following:

Go to Manage User Access > Enter ‘Action Checks’ as User Access Type > Enter the User Role for which these validations are to be performed > Click ‘Edit User Access’


In the screen we need to select:

Audit Action ID: This drop down covers all standard user actions. For our scenario select ‘ADD ORDER BASE’ as the audit action.

Allow Condition: As the name suggests this is the SQL condition that should pass in-order for error NOT TO DISPLAY:


In above query we are saying that for error not to display, source_location_gid <> ‘DEFAULT’  OR OB. Attribute2(Address line1) is not null.

Cause: This is a label with reason text that you want to provide to user as error reason. Note Type of label=ERROR.




Post Action Check: This if checked performs validation after the execution of action and before data is saved to the database. Note that for Delete Record validations, this should be unchecked. Also you can add same Audit Action validation one with Post Action Check and other with Pre Action Check based on your requirements.

Testing:
If user tries to save a PO without entering both the details mentioned above, user will receive error:




No comments:

Post a Comment