Aug 20, 2019

Display Current Date | OAF Page

        To Create an Date Bean programmatically

        OAMessageDateFieldBean currentdate =  (OAMessageDateFieldBean)createWebBean(pageContext,
                                                                                      OAWebBeanConstants.MESSAGE_DATE_FIELD_BEAN,
                                                                                       null,
                                                                                           "datefield");
                                                                                           currentdate.setReadOnly(true);

        pageLayoutBean.addIndexedChild(currentdate);


               
         To Initialize Date
               
   OAApplicationModule am = pageContext.getApplicationModule(webBean);--Initialize/Invoke AM
   SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");   -- Formatting
   String dateString = am.getOADBTransaction().getCurrentDBDate().toString();--Get DB Date from AM


   java.sql.Date sqlDate = null;

        Parsing Date Format 

        try {
            sqlDate = new Date(f.parse(dateString).getTime());
            System.out.println("What is sqlDate value ********** " + sqlDate);
         }
        catch (ParseException e) {
            e.getMessage();
        }

        OAMessageDateFieldBean dateField =
            (OAMessageDateFieldBean)webBean.findIndexedChildRecursive("datefield");
       
        To set current Date in Bean

        if (dateField != null) {
            dateField.setValue(pageContext, sqlDate);
            System.out.println("I am checking dateField  not null ********* " + dateField );
        }


No comments:

Post a Comment

Useful Workflow Commands

  WFLOAD apps/columbus789 0 Y DOWNLOAD APEXP_FINDEV.wft APEXP Locations: $PO_TOP/patch/115/import/US/porpocha.wft $PO_TOP/patch/115/import/U...