Friday 3 January 2014

Enforcing field entry in Forms Personalization

I received a requirement to make the Anticipated Date field on the Payment Batch form mandatory for all users if the Payment Method field is Electronic. It seemed to be a very straight forward requirement whereby I only check the value of the Payment Method field and make the Anticipated Date field property, Required = True, by personalizing the form.
What I did not realize was the fact that this form is a folder form. Hence this personalization would have no effect if the form folder view did not show Anticipated Date field. Had there been a folder where the Anticipated Date field was viewable from the beginning then it would work. I had a very difficult time figuring out what to do as I could not force the users to make the Anticipated Date field viewable from Folder > Show Field > Anticipated Date
I hit upon another idea. Why not check whether the field Anticipated Date has a value whenever the control moves out from the record and the user tries to click on a button? If there was no value in the field I could raise an error message and stop the user from proceeding further. This worked out and I later on used this method for many other requirements.
 
To personalize the form,
Open the Payment Batch
Navigate to Help > Diagnostics > Custom Code > Personalize
Condition
Personalization Condition
Set the values
Trigger Event: WHEN-VALIDATE-RECORD
Trigger Object: BAT_SUM_FOLDER
Condition: :BAT_SUM_FOLDER.PAYMENT_METHOD != ‘Check’ AND :BAT_SUM_FOLDER.ANTICIPATED_VALUE_DATE IS NULL AND :BAT_SUM_FOLDER.CHECK_DATE > TO_DATE (’27-JUN-2011′, ‘DD-MON-YYYY’)
The condition for 27-Jul-2011 was kept as this personalization went live on 27-Jul-2011. This meant that any payment batch created before 27-Jul-2011 would not be affected.
 
Actions
Personalization Action
Message Type: Error
Message Text: Please enter the Anticipated Value Date.
If this field is not shown on the form please make it viewable by going to the following path.
Path: Folder > Show Field > Anticipated Value Date
When we indicate to Oracle that an Error message is to be shown to the user, Oracle prevents further processing of data until the error has been rectified.
 
Now let us see the form in action.
Go to,
Responsibility: Payables responsibility
Navigation: Payments > Entry > Payment Batches
Create a payment batch
Notice that when we create a payment batch the field, Anticipated Value Date, is non mandatory even though the Payment Method is set to Electronic.
Click on Save or Actions.
Error message

3 comments:

  1. Hi !

    You write bout adding an extra field using "Show field". I'm trying to do this using personalization.

    In the form Agreements --> Fundings (PA), I'm trying to add the column "FUNDINGS.PROJFUNC_ALLOCATED_AMOUNT_CHAR" from the database.

    I sat DISPLAYED (APPLICATIONS COVER) to TRUE, but the new column didn't appear.



    When I did a lot of reshuffling of alle the columns, I suddenly discovered that the extra column was hidden behind the others. I have tried a lot of ways to make it appear normally, but I'm unable to do so. Could you please guide me ?

    ReplyDelete