Tuesday, January 11, 2011

Build a new WF process and use in EBS

The Quick Start Wizard lets you begin designing a workflow process immediately. It first loads a file called wftemplate.wft that is an outline of all the mandatory objects you need to build a workflow process and then displays a Process window for you to diagram your process.
Select Quick Start Wizard from the File menu or click on the quick start icon in the toolbar. Fill in the form that pops up.



After clicking OK the following happens:
- A  new data store is created called "Untitled-n" in the Navigator window.
- The information you entered in the Workflow Quick Start Wizard window Is used to create a new item type and process activity in the data store.
- The Standard item type is loaded into the new data store so that you can include standard activities in the process you create.
- The Process window opens for the new process activity you defined. The Process window displays a Start and an End activity.







To create a database activity, right click somewhere in the process window and select New Function.


You can use a FYI notification to send the message. Right click again in the process window and select New Notification.

Connect the activities in the Process window by right clicking the start activity. Hold the mouse button down. Drag the mouse to the message activity. Release the mouse button. Repeat this to connect the rest.
Don’t forget to save occasionally, During the save action you will receive some error messages. Ignore them and press save again.
Your process will be look like this:

To create the message right click on message in the navigator tree.


 On the message tab:


 On the body tab:

 Create an attribute (right click on attributes in the navigator tree).


Also add three other attributes.
Internal name : NAME, WISH and ADDRESSEE
Type : TEXT
Create a message attribute also called MESSAGE_TEXT.

With the following properties:

This will copy the value of the ITEM ATTRIBUTE to the MESSAGE ATTRIBUTE at runtime.
Link the message to the notification. Double click the notification in the Process window.

Select on the node tab of the notification as performer type Item Attribute and as value Adressee. Save your process again. No error message if everything is ok.

Save your process to the database. Select file/save as.

 Create a database package (in the APPS schema) like below:
CREATE OR REPLACE PACKAGE APPS.DEMO
AS

  PROCEDURE CREATE_HF_MESSAGE (itemtype in varchar2,
                               itemkey in varchar2,
                               actid in number,
                               funcmode in varchar2,
                               resultout out varchar2
                              );

END DEMO;
/

CREATE OR REPLACE PACKAGE BODY APPS.DEMO
AS
  PROCEDURE CREATE_HF_MESSAGE (itemtype in varchar2,
                               itemkey in varchar2,
                               actid in number,
                               funcmode in varchar2,
                               resultout out varchar2
                              ) AS
                            
  l_name varchar2(100);
  l_wish varchar2(100);

  BEGIN
  --execute only in run mode

  if ( funcmode = 'RUN' ) then

   -- Read attribute values
   
    l_name := wf_engine.GetItemAttrText(itemtype => itemtype,
                                        itemkey => itemkey,
                                        aname => 'NAME'
                                       );
    l_wish := wf_engine.GetItemAttrText(itemtype => itemtype,
                                        itemkey => itemkey,
                                        aname => 'WISH'
                                       );
  --create the message text
    wf_engine.SetItemAttrText (itemtype    => itemtype,
                               itemkey => itemkey,
                               aname => 'MESSAGE_TEXT',
                               avalue =>  l_wish||' ' ||l_name
                              );

    resultout := 'COMPLETE';

  end if;

  exception
    when others then
        wf_core.context('DEMO','CREATE_HF_MESSAGE',itemtype,itemkey,actid,funcmode);
        raise;

  END CREATE_HF_MESSAGE;

END DEMO;
/

Verify your WF from applications, login by sysadmin
Responsibility:Workflow Administrator Web Applications
Administrator Workflow > Developer Studio

Run the process by clicking on Run icon, provide values for attributes

 Click on Status Monitor and check status for the WF instance.




Test by User

Assign "Workflow User Web Applications" responsibility to user to whom you have addressed in your workflow as above (ie; INAM), use sysadmin account and "User Management" responsibility for this activity.
Now log in with the user (ie; INAM in our case) and use Personalize Button to add
Advanced Worklist (Workflow User Web Applications)

select advance worklist and then add and apply

Press Home link to go to home screen

Click on "Advanced Worklist (Workflow User Web Applications)"  in the Favorites.

Click on Subject "Hello Firends Message"


No comments:

Post a Comment