--------------Calling Workflow From PLSQL-----------------------
DECLARE
x_itemtype wf_item_types.NAME % TYPE;
x_itemkey VARCHAR2(200);
x_process VARCHAR2(200);
p_mail_id VARCHAR2(200);
p_requester VARCHAR2(100);
p_vendor_name VARCHAR2(200);
BEGIN
--Assigning values to Variables---
x_itemtype: = 'XXAD_SUPP' -- This should be internal name of workflow
x_itemkey: = '12345'
x_process: = 'XXAT_SUPP_APRVL' ---Workflow Process Internal name
p_requester : = fnd_profile.VALUE('USERNAME');
p_mail_id: = 'xyz@abc.com';
p_vendor_name: = 'AD Infotech Pvt Ltd';
--First we need to create the process---
wf_engine.createprocess(itemtype = > x_itemtype,
itemkey = > x_itemkey,
process = > x_process);
--Assign values to Attributes of the workflow --
wf_engine.setitemattrtext(itemtype = > x_itemtype,
itemkey = > x_itemkey,
aname = > 'VENDOR_NAME', --Internal name of Workflow Attribute
avalue = > p_vendor_name);
wf_engine.setitemattrtext(itemtype = > x_itemtype,
itemkey = > x_itemkey,
aname = > 'VENDOR_EMAIL_ID', --Internal name of Workflow Attribute
avalue = > p_mail_id);
wf_engine.setitemattrtext(itemtype = > x_itemtype,
itemkey = > x_itemkey,
aname = > 'REQUESTER', --Internal name of Workflow Attribute
avalue = > p_requester);
--Start the workflow Process --
DBMS_OUTPUT.put_line('Workflow Started');
wf_engine.startprocess(itemtype = > x_itemtype,
itemkey = > x_itemkey);
COMMIT;
EXCEPTION WHEN OTHERS
THEN
DBMS_OUTPUT.put_line('Error in Starting Workflow:-' || SQLERRM);
END;
can we use case statement in avalue
ReplyDelete