Wednesday, January 29, 2014

Launch Workflow from PL/SQL Code





Step 1:- Create a new item type

            Internal Name:- X05_WF01

            Display Name:- XXC05 WF01 Simple

            Description:- XXC05 WF01 Simple


Step 2:- Now create a new Process.

            Right click on processes and create new process

                        Internal Name:- XXC05_WF01_PROCESS

                        Display Name:- XXC05 WF01 First Process

                        Description:- XXC05 WF01 First Process

Step 3:- Double Click on Process then open Process window.

Step 4:- Right click on Process Window and create new function

            Set Values:
                        Item Type:- Standard
                        Internal Name:- START

 Then Click Node Tab
            Label:-  START
            Start/End:-  Start
Then Click OK
.
Step 5:- Create another Function “END” same as “START” Function

            Set Values:
                       Item Type:- Standard
                        Internal Name:- END

Then Click Node Tab
                        Label:-  END
                        Start/End:-  Start
Then Click OK
Step 6:- Create a Message.

            Right click on message and create new message.
Click on Body Tab.

            Give Subject and text body value.


Step 7:- Now we create a new Notification

            Right Click on Notification then create new Notification

                        Set Value:
                                    Internal Name:- XXC05_WF01_NOTIFICATION
                                    Display Name:- XXC05 WF01 First Notification
                                    Description:- XXC05 WF01 First Notification
Message:- XXC05 WF01 First Message

Step 8:- Then drag notification on Process Window

Step 9:- Double Click on XXC05 WF01 First Notification

            Click on “Node” Tab.
            Give value of Performer(Apps User Name which is store in FND_USER Tables)

Step 10:- Right click on Start and draw a line to Notification and then right click on notification and drag a line from notification to End.

Step 11:- Save that workflow in Database.

Step 12:- Create a PL/SQL Procedure

CREATE OR REPLACE PACKAGE XXC05_WF001_WORKFLOW_PKG
IS
    PROCEDURE LAUNCH_WORKFLOW;
END XXC05_WF001_WORKFLOW_PKG;


CREATE OR REPLACE PACKAGE BODY XXC05_WF001_WORKFLOW_PKG
IS
    PROCEDURE LAUNCH_WORKFLOW
    IS
    BEGIN
        WF_ENGINE.CREATEPROCESS(ITEMTYPE => 'X05_WF01'
                              , ITEMKEY  =>  100
                              , PROCESS  => 'XXC05_WF01_PROCESS'
                                );
                           
        WF_ENGINE.STARTPROCESS(ITEMTYPE => 'X05_WF01'
                              ,ITEMKEY  =>  100
                               );
    END LAUNCH_WORKFLOW;
END XXC05_WF001_WORKFLOW_PKG;


Now Execute That Package Procedure
           
Begin
            XXC05_WF001_WORKFLOW_PKG. LAUNCH_WORKFLOW;
      Commit;    
End;

No comments:

Post a Comment