You are on page 1of 4

Example 1

/*Complete the 'ENTER ORDER' activity for the 'ORDER' item type. The 'ENTER ORDER'
activity allows creation of new items since it is the start of a workflow, so the
item is created by this call as well.*/

wf_engine.CompleteActivity('ORDER', to_char(order.order_id),
'ENTER_ORDER', NULL);

Example 2

/*Complete the 'LEGAL REVIEW' activity with status 'APPROVED'. The item must
already exist.*/

wf_engine.CompleteActivity('ORDER', '1003', 'LEGAL_REVIEW',


'APPROVED');

Example 3

/*Complete the BLOCK activity which is used in multiple subprocesses in parallel


splits.*/

wf_engine.CompleteActivity('ORDER', '1003', 'ORDER_PROCESS:BLOCK-3',


'null');

DECLARE
itemtype VARCHAR2(20) := 'GIM_POC';
itemkey VARCHAR2(20) :='GIM_POC-102';
process VARCHAR2(20) :='GIM_MAIN';
user_key VARCHAR2(20) :='GIM_POC-102';
owner_role VARCHAR2(20) :='KPIT_DEV';
BEGIN
WF_ENGINE.CreateProcess(itemtype ,
itemkey ,
process ,
user_key ,
owner_role );

WF_ENGINE.StartProcess(itemtype,itemkey);

END;

DECLARE
itemtype VARCHAR2(20) := 'GIM_POC';
itemkey VARCHAR2(20) :='GIM_POC-102';
process VARCHAR2(20) :='GIM_MAIN';
user_key VARCHAR2(20) :='GIM_POC-102';
owner_role VARCHAR2(20) :='KPIT_DEV';
BEGIN
WF_ENGINE.CompleteActivity(itemtype ,
itemkey ,
'GIM_MAIN:BLOCK-PO' ,
NULL );

END;

1.Notification Must Have a Message


2.Notification Must Have a Performer
3.
DECLARE
itemtype VARCHAR2(20) := 'GIM_POC';
itemkey VARCHAR2(20) :='GIM_POC-102';
process VARCHAR2(20) :='GIM_MAIN';
user_key VARCHAR2(20) :='GIM_POC-102';
owner_role VARCHAR2(20) :='KPIT_DEV';
BEGIN
WF_ENGINE.CreateProcess(itemtype ,
itemkey ,
process ,
user_key ,
owner_role );

WF_ENGINE.StartProcess(itemtype,itemkey);

END;

WF_STANDARD
XXMTL_ITEM_CREATION_REQUESTS
DECLARE
itemtype VARCHAR2(20) := 'GIM_POC';
itemkey VARCHAR2(20) :='GIM_POC-102';
process VARCHAR2(20) :='GIM_MAIN';
user_key VARCHAR2(20) :='GIM_POC-102';
owner_role VARCHAR2(20) :='SYSADMIN';
BEGIN
WF_ENGINE.CompleteActivity(itemtype ,
itemkey ,
'GIM_MAIN:BLOCK-PO' ,
NULL );

END;

Declare
ln_seq NUMBER;
itemtype VARCHAR2(20) := 'GIM_POC';
itemkey VARCHAR2(20) ;
process VARCHAR2(20) :='GIM_MAIN';
user_key VARCHAR2(20) ;
owner_role VARCHAR2(20) :='SYSADMIN';

BEGIN
select XXMTL_GIM_SEQ.netxval
into ln_seq
from dual;

itemkey := ln_seq;
user_key := 'GIM_POC-'||ln_seq ;

INSERT INTO XXMTL_ITEM_CREATION_REQUESTS (


ITEM_CREATION_REQUEST_ID ,
ORGANIZATION_CODE ,
ITEM_CODE ,
DESCRIPTION ,
ADD_INFO_FOR_APPROVER ,
APPROVAL_STATUS ,
CREATION_DATE ,
CREATED_BY ,
WF_ITEM_KEY ) VALUES (
ln_seq,
'V1',
'AS'||ln_seq,
'AS'||ln_seq,
'AS'||ln_seq,
'WAITING APPROVAL',
sysdate,
-1,
ln_seq );

WF_ENGINE.CreateProcess(itemtype ,
itemkey ,
process ,
user_key ,
owner_role );

WF_ENGINE.SetItemAttrText(itemtype ,
itemkey ,
'ITEM_CODE' ,
to_char(ln_seq));

WF_ENGINE.StartProcess(itemtype,itemkey);

END;

(
NUMBER,
VARCHAR2(3 BYTE),
VARCHAR2(40 BYTE),
VARCHAR2(150 BYTE),
VARCHAR2(150 BYTE),
VARCHAR2(30 BYTE),
DATE,
NUMBER,
DATE,
NUMBER,
NUMBER,
VARCHAR2(30 BYTE)
)
LOGGING
NOCACHE
NOPARALLEL;

Create or Replace Package XXWF_GIM_PKG IS


PROCEDURE P_CREATE_ITEM_TEMPLATE_XREF(itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout IN OUT NOCOPY VARCHAR2);
END XXWF_GIM_PKG;

Create or Replace Package BODY XXWF_GIM_PKG IS


PROCEDURE P_CREATE_ITEM_TEMPLATE_XREF(itemtype IN VARCHAR2,
itemkey IN VARCHAR2,
actid IN NUMBER,
funcmode IN VARCHAR2,
resultout IN OUT NOCOPY VARCHAR2) IS
BEGIN
INSERT INTO XXMTL_ITEM_TEMPLATE_XREF (
ITEM_TEMPLATE_XREF_ID ,
ORGANIZATION_CODE ,
ITEM_CODE ,
TEMPLATE_TYPE ,
TEMPLATE_NAME ,
APPROVAL_STATUS ,
CREATION_DATE ,
CREATED_BY ,
LAST_UPDATE_LOGIN ,
WF_ITEM_KEY ,
WF_ITEM_TYPE ) VALUES (

END ;
END XXWF_GIM_PKG;