Skip to content

Green

color

Default screen resolution  Wide screen resolution  Increase font size  Decrease font size  Default font size  Skip to content Default color Pink color Green color Green color
Home arrow Technical Articles arrow Oracle Workflows arrow Basics of Oracle Workflows Engine
This website has now moved to http://apps2fusion.com





Basics of Oracle Workflows Engine | Print |  E-mail
Written by Sudhakar Jukanti   
Tuesday, 20 February 2007
Please find yet another article written by Oracle Workflow Expert Mr Sudhakar Jukanti, whereby he explains the key API's of Oracle Workflow Engine.
     Thanks Sudhakar for yet another contribution to Oracle Apps Community. Sudhakar also happens to be a CSCP (certified supply chain professional)

The Oracle Workflow Engine:

-->       Is implemented in server-side PL/SQL.
            Combination of Tables/Views/Packages and procedures
-->       Manages the state of activities for each process instance.
-->       Determines the next activity once a prerequisite activity completes.
-->       Executes function activities automatically.
-->       Calls the Notification System to send notification messages
-->       Supports results-based branches, parallel branches, loops, and sub-processes.
-->       Can execute activities from non-savepoint environments such as database triggers and distributed transactions.
-->       Can defer activities too costly to execute in real time to background engines for processing.
-->       Maintains a history of completed activities.
-->       Detects error conditions and executes error processes.


 
Initiating a Workflow Process
We Call the Workflow Engine APIs to initiate a workflow process,
Use the CreateProcess and StartProcess APIs if you want to perform additional tasks, such as setting item attributes, after creating and before starting the process.
If you do not need to perform any additional tasks, you can use the LaunchProcess API, which is a wrapper combining the CreateProcess and StartProcess APIs.

The procedure that executes the Workflow Engine APIs to initiate a process must identify the item type and item key of the process for these APIs. The item type and item key passed to these APIs uniquely identify an item and must be passed to subsequent API calls for each specific process.


Workflow Engine Processing
Upon starting a process, the Workflow Engine:
-->       Identifies and executes the Start activity node
            Executes the Start node if it is a function, notification, or process activity
-->       Determines the next activity to transition to after completing the prerequisite activity or activities
-->       Drives through the process
           Automatically executes function activities and Send or Raise event activities
           Pauses when it encounters a notification activity or blocking activity
-->       Calls the Notification System to notify a performer
           Transitions to the next activity after the performer completes the notification,
           the blocking activity is completed, or the event message is received
-->       Stops when it encounters an End activity
 

Exception Handling
Use WF_CORE APIs to raise and catch errors in your PL/SQL procedures.

The Workflow Engine sets the status of the function activity to “ERROR” if:
          The PL/SQL procedure raises an unhandled exception
          The PL/SQL procedure returns a result beginning with “ERROR:”

If an activity encounters an error, information about the error is stored in the following columns in the WF_ITEM_ACTIVITY_STATUSES table, which are viewable from the Workflow Monitor.
-->ERROR_NAME
-->ERROR_MESSAGE

 

 
WORKFLOW ENGINE API’s
To start or run a workflow process
-->WF_ENGINE.CreateProcess creates a new runtime process for a work item.
-->WF_ENGINE.StartProcess begins execution of the specified process.
-->WF_ENGINE.LaunchProcess launches a specified process by creating the new runtime process and beginning its execution.
-->WF_ENGINE.SetItemOwner sets the owner of an existing item.
-->WF_ENGINE.SetItemUserKey sets a user-friendly identifier for an item.
-->WF_ENGINE.GetItemUserKey returns the user-friendly identifier assigned to an item.
-->WF_ENGINE.SetItemParent defines the parent/child relationship for master/detail processes.
-->WF_ENGINE.Event receives an event from the Business Event System into a workflow process.
-->WF_ENGINE.Background runs a background engine to process deferred and timed out activities and stuck processes.
-->WF_ENGINE.CreateForkProcess forks a runtime process by creating a new process that is a copy of the original.
-->WF_ENGINE.StartForkProcess begins execution of the specified new forked process.
 

 
To communicate attribute information to the Workflow Engine
-->WF_ENGINE.SetItemAttrText, WF_ENGINE.SetItemAttrNumber, WF_ENGINE.SetItemAttrDate, and WF_ENGINE.SetItemAttrEvent set the value of an item type attribute in a process.
-->WF_ENGINE.SetItemAttrTextArray, WF_ENGINE.SetItemAttrNumberArray, and WF_ENGINE.SetItemAttrDateArray set the values of an array of item type attributes in a process.
-->WF_ENGINE.GetItemAttrText, WF_ENGINE.GetItemAttrNumber, WF_ENGINE.GetItemAttrDate, and WF_ENGINE.GetItemAttrEvent return the value of an item type attribute in a process.
-->WF_ENGINE.GetItemAttrInfo returns information about an item attribute, such as its type and format.
-->WF_ENGINE.AddItemAttr adds a new item attribute to the runtime process.
-->WF_ENGINE.AddItemAttrTextArray, WF_ENGINE.AddItemAttrNumberArray, and WF_ENGINE.AddItemAttrDateArray add an array of new item type attributes to the runtime process.
-->WF_ENGINE.GetActivityAttrText, WF_ENGINE.GetActivityAttrNumber, WF_ENGINE.GetActivityAttrDate, and WF_ENGINE.GetActivityAttrEvent return the value of an activity attribute in a process.
-->WF_ENGINE.GetActivityAttrInfo returns information about an activity attribute, such as its type and format.

 

 
To communicate state changes to the Workflow Engine
-->WF_ENGINE.CompleteActivity notifies the engine that the specified activity has been completed for the item, identifying the activity by the activity node label name.
-->WF_ENGINE.CompleteActivityInternalName notifies the engine that the specified activity has been completed for the item, identifying the activity by its internal name.
-->WF_ENGINE.BeginActivity determines if the specified activity can currently be performed and raises an exception if it cannot.
-->WF_ENGINE.AssignActivity assigns an activity to another performer.
-->WF_ENGINE.GetActivityLabel returns the instance label of an activity, given the internal activity instance identification.
-->WF_ENGINE.AbortProcess aborts process execution and cancels outstanding notifications.
-->WF_ENGINE.SuspendProcess suspends process execution so that users cannot transition items to new activities.
-->WF_ENGINE.ResumeProcess returns a suspended process to normal execution status.
-->WF_ENGINE.HandleError handles any activity that has encountered an error. This API can also be called for any arbitrary activity in a process to roll back part of the process to that activity.
-->WF_ENGINE.ItemStatus returns the status and results for the root process of the specified item instance.

Comments (34)add
...
written by Anil Passi , March 28, 2007
Hi Nikhil

Unfortunately there are no shortcuts to learning. You need to try the tutorials that are here/elsewhere. If you get stuck, then please ask.

thanks
anil
...
written by NikhiL , March 28, 2007
Hi anil

I am nikhil V railkar working as technical consultant in chennai
My problem is that i have told to work on workflows and will be assigned task on client site in aboroad but i am comfortable with it
i need a small favour from ,if you can send me 2 workflows with all the documents related to it i will be grateful to you

Regard
Nikhil
...
written by swapna , April 02, 2007
Hi Anil,
Would like to thank you for the knowledge that you are sharing with us. I have few questions about workflow. I would like to know what can/cannot be achieved from seeded workflows.Can you please let me know some scenarios where the functionality cannot be achieved by seeded workflow and need customization.
Thank you
Swapna
...
written by Anil PAssi , April 04, 2007
Hi Swapna

Account generation is one workflow that almost always requires customization, as each customers has a unique account structure and account generation rules.

Thanks,
Anil Passi
...
written by Anil Passi , April 25, 2007
Hi,

You will have to customize the workflow in this case.

But before customization, check if this notification is based on OA Framework, in which case you can simply personalize and extend the notification.

Thanks,
Anil Passi
...
written by A Desai , April 25, 2007
Hi Anil,

Thanks a lot. Yes this this notification is based on OA Framework. How do I personalize (meaning find the name of the field from the form, map that name to create internal item attributes in WF) ?
I am able to extend the notification but these new fields not available in vanila WF (HRSSA) need to be added as new item attributes.

Thanks in advance !

A Desai
...
written by Anil Passi , April 25, 2007
You have various options to accomplish this.

The easiest way would be that you create a new StackLayout page and then include that within the notification message, just as other stacklayouts have been included for that notification.

I will try to write up a step by step approach for creating a Fwk based notification, but that will take me a week.

Thanks,
Anil
...
written by A Desai , April 25, 2007
Hi Anil,

Thanks again for quick response. My question for the existing field available on HR Self Service (HRSSA) form, for examle National Identifier. But the same field is not available in the WF, activate when the New Hire request is submitted. How do I hook up this field available on form to the respective notification. If I create new item attibute named NATIONAL_IDENTIFIER (this is the corresponding column name in the table) and pass &NATIONAL_IDENTIFIER in the message body of the Message it does not work. Am I missing something ?

Thanks in advance !
A Desai
...
written by A Desai , April 25, 2007
Hi Anil,

Thanks again for quick response. My question for the existing field available on HR Self Service (HRSSA) form, for examle National Identifier. But the same field is not available in the WF, activate when the New Hire request is submitted. How do I hook up this field available on form to the respective notification. If I create new item attibute named NATIONAL_IDENTIFIER (this is the corresponding column name in the table) and pass &NATIONAL_IDENTIFIER in the message body of the Message it does not work. Am I missing something ?

Thanks in advance !
A Desai
...
written by Anil Passi , April 26, 2007
Hi A

Yes, if that attribute has been assigned NI Number, and if that Attribute is avaiable under the Message, then you can use &ATTR to reference its value. See if your message has contents in text or under html tab.

Thanks,
Anil Passi
...
written by sai , May 04, 2007
Anil,

I have a laptop with XP Home Edition. What all softwares do i have to install, in order to work out all the examples you have provided in the site. Thanks in advance.

Sai.
...
written by Anil Passi , May 06, 2007
Hi Sai

You need Oracle database with Workflow engine installed. Also you would need Oracle WF Client which gets installed automatically with 9i or 10g client

Thanks,
Anil
...
written by Mandar , May 15, 2007
Hi Anil,

I normally refer the functional documents that you have prepared and uploaded, some of which have efforts shared by others like Sivakumar Ganesan. These pdfs have been great help in my faltering steps to learn Apps.
I am a functional consultant and hardly know about technical architecture or concepts.
What approach should I take to understand Oracle Workflows and specifically how to implement and customize those for OM module?

Thanks,

Mandar.
...
written by satyaram , May 20, 2007
hi Anil,

I have to make a report on workflow programs that are struck in process displaying at what stage they are struck.
can you help on this report.

Thanks And Regards,
SatyaRam
...
written by Vineet , May 21, 2007
Anil,

Can you please post a lession on debugging of workflow?

Thanks,
Vineet
...
written by Murthy Ganjam , May 23, 2007
one thing i would like to know is can i have list of values to a response varibale.i would like to populate it from the sql.
How to create a array type item attribute??And how to populate it?Can you plz clarify
...
written by yogita sarang , June 15, 2007
hi anil,
actually i am hrms techno-fuctional.i am asked to go onsite and work on workflow.
not getting how to go for preparing workflow fast.

regards,
yogita.
...
written by Rajesh Jha , June 27, 2007
Hi Anil
THANKS for the useful info. I have a query too.

When we send a notification for some approval, the performer can
either approve, reject or request more info. While handling
approval rejection is not a big deal. I want to send reminder
notification if the requestor do not replies (after approver
asks for more info). So how to handle this timeout after
requesting more info.Any suggestion would be of great help..

Thanks Again
...
written by Anil Passi , June 27, 2007
Hi Rajesh

You will find the answer in below link

http://oracle.anilpassi.com/oracle-workflow-notifications-timeouts-with-bank-holidays-weekends-2.html

Yes, timeouts are possible, you can see that option in the Notification Properties window

Thanks
Anil
...
written by AK , July 07, 2007
Hi Anil,
I am customising PO Approval workflow(11.5.10) . one of my requirement is to
find the employee_number of an employee to whom the notification is
sent for approval. I need this employee number to call an another
custom function to do some processing. I get the person_id from
APPROVER_EMPID(Approver employee id) attribute. but to find
employee_number can i query from my custom package(written for
customising a workflow process in PO Approval) like select
employee_number from PER_ALL_PEOPLE_F where person_id='1234'. is it
the right approach to find the employee_number if we know the
person_id ?
Regards
Arun
...
written by Anil Passi , July 08, 2007
Hi AK
Yes your approach is right.

n_approver_person_id :=
wf_engine.getitemattrnumber
(
itemtype => itemtype
,itemkey => itemkey
,aname =>'APPROVER_EMPID'
) ;


FUNCTION get_person_number(p_person_id IN INTEGER) RETURN VARCHAR2 IS
CURSOR c_get IS
SELECT employee_number
FROM per_all_people_f
WHERE person_id = p_person_id;
p_get c_get%ROWTYPE;
BEGIN
OPEN c_get;
FETCH c_get
INTO p_get;
CLOSE c_get;
RETURN p_get.employee_number;
END get_person_number;

X_person_number := get_person_number( p_person_id =>n_approver_person_id) ;

Thanks,
Anil Passi
...
written by AK , July 08, 2007
Hi Anil,
Thanks for your response.much appreciated
Arun
...
written by William , July 16, 2007
HELP !!!

If in the CreateProcess the Process already exists, what must make ?
Please, answer in my e-mail.

ps: Sorry for my English, but i am brazilian and don't speak english.
...
written by mondher , August 29, 2007
hi anil
Thank you for your help understanding workflow. I try to run the example in your first
lesson but i have problem to execute wf_engine package . i try to execute it
from owf_mgr but same result. the package wf_engine is in the schema and status is valid
the oracle database is 10.2.
best regards

mondher

...
written by Anil Passi , August 30, 2007
Hi Mondher

To implement the WF tutorials on this site, you must execute the same from apps schema.
If you are using standalone version, then please note that it has been de-supported

Thanks,
Anil
...
written by Muralidhar , August 30, 2007
Hi,

I am new into worklfow. However our company is using oracle workflow since last few years.

I want to process stuck jobs,

Eg: I have a jobid 1 which is completed import task, but while executing export task it got failed due to table space issue. Now the table space issue has been resolved the but job is not getting completed.

Please let me know how can i run export task, i don't want to run using launch process because various jobs are stuck at various stages. I want something it should start from wherever it stopped earlier.

Thanks & Regards,
Muralidhar S
...
written by Ramelu , September 04, 2007
Hi Anil,

I have an issue in workflow where the workflow notification has been sent to the person who does not belongs to particular workflow. Eg: The workflow notification is coming to the user for a particular order number, where the user is no way related to that order number.The user want to stop this notification and he also want to know where does it comes from.
Can you please suggest.

Regards,
Ram.
...
written by Nasar Zia , September 15, 2007
Hi anil

I am getting WF status no approver available ,Check approval group ,approver hierarchy in purchasing ,I check account range and amount for approver group it is all set right,I run request for employee hierarchy and synchromization WF tables,

The proble is employee Ashok not in the hirarchy raised a iproc requisition and forwarded for approval to emp Veneet he is in approvar hirarchy but having limit to approve only 50,000 amount so it should go to next level that is employee Jagdeep but it does not reach to him and requisition status says incomplete.

I checked workflow its status is no approver available.Please send solurion for the same or possible cause of problem.

Best Regards
Nasar Zia

...
written by Vamsi , September 17, 2007
Hi Anil,

My requirement is When a dispute is created in Oracle through collections form, need to capture all the details (customer_trx_id, amount) into a JMS queue. For this scenario can we customize the existing workflow (ARCMREQ, which is internally invoked by AR_CREDIR_MEMO_API_PUB package) to add a process/function?

Another question is, Does Oracle support to modify the standard workflow?

Please provide your valuable suggestions....

Thanks,
Vamsi
...
written by Anil Passi , October 08, 2007
Hi Vamsi

No customization can ever be safe.
But given that there is no business event, you can consider customizing the workflow.

If there is merely one screen from which disputes are being created, then you can also consider writing FP/CUSTOM.pll

Thanks,
Anil Passi
Notificatuions toMultiple users
written by AllaKishore , October 29, 2007
Hi,

Can you please let me know hoe to send same notifications to more than one user?

Thanks and regards
Alla Kishore
...
written by Anil Passi , October 29, 2007
Please search Metalink for "Expand Roles"
That will explain.

For example, a responsibility is a role, and all users assigned to the responsibility can be notified if notification gets sent to resp role

thanks
anil
ARCMREQ workflow modification
written by Amit Nene , December 19, 2007
Hi,
When we create a dispute, a line gets created in the history tab of the 'Collection Agent' screen with status as 'Pending Approval'. Our requirement is that whenever a line gets created, it should have the status as either 'Applied' or 'Closed'.
The workaround that we are thinking is to bypass all the approvals required in between. I need your inputs as how safe this customization can be?
And what can be the impact on the standard oracle process?
Also it will be very nice if you can tell me what all changes I might need to make in the workflow to achieve the results?
Thanks in advance,
Amit
SCM
written by SDadi , March 12, 2008
Hi Anil,

This Santosh, working as Apps Consultant in Oracle from past 2.5 yrs. I am planning to take CSCP for OM. I have oracle study guides. Do you suggest any other books/use cases that would be helpful with my preperation?

Thanks,
Santosh.
You must be logged in to a comment. Please register if you do not have an account yet.

busy