Friday, January 31, 2014

How to Execute PL/SQL Code from Workflow

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 Package in Database which is execute from Workflow
CREATE OR REPLACE PACKAGE XXC05_WF001_EXECUTE_PKG
IS
PROCEDURE EXECUTE_PRO(itemtype         IN VARCHAR2
                                                  , itemkey          IN VARCHAR2
                                                  , actid              IN NUMBER
                                                  , funcmode       IN VARCHAR2
                                                 , resultout         OUT NOCOPY VARCHAR2
                                                  );
END XXC05_WF001_EXECUTE_PKG;


CREATE OR REPLACE PACKAGE BODY XXC05_WF001_EXECUTE_PKG
IS
PROCEDURE EXECUTE_PRO(itemtype         IN VARCHAR2
                                                  , itemkey          IN VARCHAR2
                                                  , actid              IN NUMBER
                                                  , funcmode       IN VARCHAR2
                                                  , resultout        OUT NOCOPY VARCHAR2
                                                  )
IS
BEGIN
    INSERT INTO XXC05_EMP VALUES(100,'SAJAL');
    COMMIT;
END EXECUTE_PRO;  
END XXC05_WF001_EXECUTE_PKG;

Step 7:- Create a New Function
                  Right Click on Function, Click on New Function
          
                 
                           
                              
                  Click on Apply the OK.
 
Step 8:- Create a Message.
            Right click on message and create new message.
Click on Body Tab.
            Give Subject and text body value.


Step 9:- 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 10:- Then drag notification on Process Window
Step 11:- 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 12:- Right click on Start and draw a line to Function and  Function to Notification and then right click on notification and drag a line from notification to End.
Step 13:- Save that workflow in Database.
  
Run Workflow......
After run workflow data insert into table.