Friday, July 15, 2016

RowSetIterator (OAF)

RowSetIterator (OAF)

The interface is part of oracle.jbo.
It is an iterator over a collection of View rows or Entity rows.

Most common use of the interface is to work on table regions where logic involves navigating row by row and working on the table data.

Example 1: Analyze project column value being null or not null on iProc checkout page.
Here the RowSetIterator is opened, fetched to the number of rows in the table and loops for each row to perform required task before closing the RowSetIterator.

The screen looks as below for reference.


Edit cart Screen - iProc showing advanced table region
Following code is part of processFormRequest and includes import statements as well for reference.

import oracle.apps.fnd.framework.OAViewObject;
import oracle.jbo.RowSetIterator;
import oracle.jbo.domain.Number;
import oracle.apps.icx.por.req.server.PoRequisitionLinesVORowImpl;

OAViewObject PoReqLinesVO = (OAViewObject)am.findViewObject("PoRequisitionLinesVO");


RowSetIterator rsi = null;

int totalRowCount = 0;

rsi = PoReqLinesVO.createRowSetIterator("rsi");

PoRequisitionLinesVORowImpl billingrowimp = null;
totalRowCount = PoReqLinesVO.getFetchedRowCount();

if (totalRowCount > 0)
{
 rsi.setRangeStart(0);
 rsi.setRangeSize(totalRowCount);

 for (i=0; i<totalRowCount; i++)

{
 billingrowimp = (PoRequisitionLinesVORowImpl)rsi.getRowAtRangeIndex(i);
         if (billingrowimp != null)
           {
              if (billingrowimp.getProjectNumber() != null)
               {<PERFORM TASK HERE>}
            }
         }
  rsi.closeRowSetIterator();

Using FND_MESSAGE in OAF Page

Using FND_MESSAGE in OAF Page

Define message in application:

You can use Application Developer - Message to create a message text. Alternatively using Functional administrator - Core Services - Messages you can create a new message as well.


Define Message
To use the message in the page controller file, use the below piece of code in processFormRequest or wherever your logic requires.

throw new OAException("<APPLICATION SHORT NAME>", "<MESSAGE_CODE>", null, OAException.ERROR, null);

This will show an Error message as long as the conditions are met on the page.

Monday, July 11, 2016

Oracle Workflow: Sample FYI notification


Oracle Workflow: Sample FYI Notification

While working on a custom workflow, I found an issue on the FYI message(Notification),where the button on the notification said 'Submit' instead of 'Ok'. To find out if the FYI notifications always behave like this or there is something wrong on the custom workflow, I needed to test a sample FYI. Below are the steps for a quick test.

Navigator


Process Screen

Message Properties - Message Tab
Message Properties - Body Tab


Notification Properties

Add the appropriate ROLE on the Performer field as shown below. This is where the notification is received.

Use below query:
select role_name from wf_user_roles where user_name = '<USER_NAME>';


Notification properties in Process - Node Tab

Save the workflow to the database and use the below code to start the workflow from SQL.

Define Procedure


create or replace PROCEDURE start_workflow

                      (x_errbuf OUT VARCHAR2

                      ,x_retcode OUT VARCHAR2) is

l_itemtype VARCHAR2(30) := 'SP_TEST'; -- Workflow Name

l_itemkey VARCHAR2(300);
begin
   l_itemkey := 'SP_TEST' || to_char(SYSDATE, 'MM/DD/YYYY HH24:MI:SS');
   apps.wf_engine.createprocess(l_itemtype, l_itemkey, 'FYI_PROCESS'); -- PROCESS NAME
   apps.wf_engine.startprocess(l_itemtype, l_itemkey);
commit;
end;

Call Procedure

declare

   l_errbuf varchar2(2000);

   l_retcode varchar2(2000);

begin

   start_workflow(l_errbuf,l_errbuf);
end;

Calling the above procedure will start the process and you should receive the notification.

In Application:

Go to Status monitor to see the details.

Notification - 1
Workflow Details
Notification with Ok Button