Wednesday, 28 October 2020

OAF: How to default current date time into a MessageDateFieldBean in Controller

This post is to show how we can default the current date time to a MessageDateFieldBean in OA framework page, where the field is not mapped to a View Object. If the field is mapped to a ViewAttribute in a View Object, we could just set the value to the ViewAttribute and it will get defaulted in the bean, when the page loads.

We need to make sure that the format matches the user's date preference set as well.

We could use OANLSServices class to acheive this.

Get the current date using java.util.Date. Pass that as an input to OANLSServices.dateTimeToString. This will return the date value in the current user preference format.

Sample Code which can be used in the processRequest function.

 //get the handle to the date field bean  
 OAMessageDateFieldBean dateFieldBean = (OAMessageDateFieldBean)webBean.findChildRecursive("CurrentDate");  
 pageContext.writeDiagnostics(this, "dateFieldBean :" + dateFieldBean, 4);  
 if (dateFieldBean != null)  
 {  
       // Get the current date  
       java.util.Date utilDate = new java.util.Date();  
       //Convert the date value into users date format  
       String dateStr = pageCtxt.getOANLSServices().dateTimeToString(utilDate);  
       pageContext.writeDiagnostics(this, "dateStr :" + dateStr, 4);  
       //set the value to the datefield bean  
       dateFieldBean.setValue(pageContext,dateStr);  
 }  

The above code will take care of the date format set in the user preferences.

Date Format set to dd-MMM-yyyy

Output
Date Format set to yyyy/MMM/dd


Output




Feel free to point out if anything is missing/wrong in this blog.

Monday, 15 June 2020

Oracle Apps: How to create validation for a date parameter using a value set for Oracle Concurrent Program

One of my colleague was looking for a solution to restrict a date parameter on a concurrent program not to allow future dates.This post is to just show how to do that as it could help someone else as well.

Step 1. 
Create a Special Value set as below



Format Type     : Standard Date
Validation Type : Special
 Event                : Validate
 
FND PLSQL "
DECLARE
  v_date DATE:= :!VALUE;
BEGIN
  IF v_date > SYSDATE THEN
    FND_MESSAGE.SET_NAME('FND','FND_GENERIC_MESSAGE');
    FND_MESSAGE.SET_TOKEN('MESSAGE','Please choose current or past date.');
    FND_MESSAGE.RAISE_ERROR;
  END IF;
END;
"
 
Step 2.
Attach this value set to the Concurrent Program Parameter.



Now try to enter a future date parameter while submitting the concurrent program.






Feel free to point out if anything is wrong/missing in this post


Tuesday, 9 June 2020

Oracle Apps: FRM-92102: A network error has occured.

At one of our client sites, some of the users were getting the below error when they try to access the environment after a clone.



"FRM-92102: A network error has occured.
        The Forms Client has attemted to reestablish its
              connection to the Server 1 time(s) without success.
                        Please check the network connection and try again later."

Initially we thought, it was something to do with their network connection. Once we confirm that the network is not an issue, we tried to do clear cache on the browser and restarting the machine etc. with no luck.

This got fixed after we cleared the Java cache. Steps to do that is given below.

1. Close all the brower windows
2. Open the Java Control Panel
        Control Panel --> Java


3. Click on Settings button
4. Click on Delete Files
5. Click OK

This will clear the Java Cache. Once the Java Cache is cleared we were able to open the forms screen without any issue.



Feel free to point out if anything is wrong/missing in this post

Monday, 20 January 2020

XML Publisher: Preview not working after Java upgrade

This post is just point out a setting which you need to modify in XML Publisher Desktop, if you have done an upgrade on Java in your machine. 


Error: After the Java update, when you try to do a Preview form XML Publisher Desktop, you get the below error message:




Solution: The reason for the error is because you have the old path set in the "Java Home " field in XML Publisher Settings. Update the Java Home in the below path.

Tools --> Options --> Preview (Tab)






Note:- The path is without the bin folder.

In my example, it is 'C:\Program Files (x86)\Java\jre1.8.0_211NOT 'C:\Program Files (x86)\Java\jre1.8.0_211\bin'



Feel free to point out if anything is wrong/missing in this post.