8/21/2014

Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine)

Peoplesoft Beginners to Expert
Beginners to Expert

Search This Blog
Search

AWE

Saturday, March 1, 2014

Creating a Simple Workflow with AWE(Approval Workflow Engine)
Creating a Simple AWE Workflow

Do you know!
Emails in PeopleSoft
Files and FIle Layout
Integration Broker

Extending Pe
Capabilities

Reading Files

Application Engine

Installing PeopleSoft on
your Laptop/Desktop

Installing Peo

Parallel Proc

Application Designer

Component Interfaces

Tutorials

With the recent release of Peopletools, peoplesoft has moved from the traditional workflow to the AWE(Approval Workflow Engine).This has
greatly segregated the designing of workflow to the functional team and the supporting objects to the Technical Developer.
Unlike Workflow , there is no requirement of creation of Components,steps,rules and routing in Application Designer.
In this way peoplesoft has tried to simplify the workflow process making it more configurable.
Starting with a simple AWE workflow we need to carry out few steps.
Lets create a simple AWE workflow which consists of only one step.
The requester requests for some amount for an asset .When the requester submits the request,
the approvers get the notification by email and worklist. The approvers are the list of all the users who are having the role of Finance Officer
(FIN_OFFCR). One of Approver approves the request and the Asset status is set to Approved else Denied.

Iscripts

Creating a Si
AWE(Approv

Using Sendm

Using MCF O
in PeopleSoft

Traversing thr
Component w

PeopleSoft T
steps.

PeopleSoft T
and Running

PTF
PeopleSoft Meta tables
Peoplecode
Peoplesoft Architecture
Reporting Tools
SQLs
Security in Peoplesoft
Webservices

To AWE to control the flow of events , Let's start with few definitions.
1.Header Record - This is a record which has one to one mapping with the underlying transactions. Every transaction should insert/update a
row in this table.
For the Workflow we are about to setup, it should be record in which every time a request for the Asset/Amount is submitted for approval,
corresponding one row is affected in this table.

I named it as T_HEADER
2.XREF Record - This is called as Cross reference record. AWE has predefined its structure as containing the subrecord EOAWAW_XREF_SBR
plus the Header’s keys as a nonkey.
The cross-reference maintains the link between AWE’s transaction tables and transaction using the keys from Header Record.
I created a XREF record as below.

3.Transaction Component
Now we need a component which will trigger the workflow or where the requester will submit the requests.

http://letsraiseourvoice.blogspot.in/2014/03/creating-simple-awe.html

1/20

8/21/2014

Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine)

Component Structure in App Designer.

I have added 3 buttons :Approve, Deny, Submit.
The buttons as suggested by their name are to Submit, Approve or Deny a Request.
At this moment all three buttons are visible but we will control its visibility as we progress.
We will later see how this page is customized to fulfill our requirements.
4. Event Handler - AWE is controlled by events, when a request is submitted, a event takes place, when a request is approved a event triggers,
when a request is denied , a event take place.
Each of these events are handled by AWE delivered class EOAW:CORE. If we want to do other stuffs than what the delivered app package
does, we need to create our Event Handler ,extending the core EOAW classes.
As of now we do not need to create any event Handler, the delivered EOAW:Core app package will do our job. But, later we will see that we
need to create an event handler to tackle our requirement.

5. Configuring AWE , Registering the transaction.
Navigate to :

Add a new Process ID, Let us create a process ID "ASSET_APPROVAL".

http://letsraiseourvoice.blogspot.in/2014/03/creating-simple-awe.html

2/20

8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Enter the Cross Reference Record which we defined in Step2. Now it is not required. Keep the Internal URL definition and External URL definitions blank. In Notification Options Select as below. We will see details of EMC in the advanced chapters on AWE.html 3/20 .blogspot. The checkbox 'Use Email Approval' and below fields are used when we are using EMC. We do not need these as of now.in/2014/03/creating-simple-awe. http://letsraiseourvoice.

This is the same transaction component we created in step We are keeping Approval Status Monitor" section as blank. Save the page. Configuring AWE . As of now we have not created any Event Handler for our workflow .8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Fill the Default Approval Component as below. Later we will replace this event handler with our event handler class. Enter the details of Header record and its key fields as below in the "Transaction Approval Levels" section.blogspot. so we will use the delivered App package and Class as shown below.html 4/20 . "Approval Status Monitor" section defines Adhoc class and Thread class. "Approval Event Handler Class" is used to do some stuffs when a particular event triggers like updating the "Status" field to "Approved/Denied" when the request is approved/Denied. As explained earlier. Adhoc class is used for entering adhoc approvers/reviewers or paths in the usual AWE workflow. We do not need these items for our simple AWE. Thread Class is used to control what is displayed in the Approval Monitor.Transaction Configuration http://letsraiseourvoice. 6.in/2014/03/creating-simple-awe.

8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) EVENTS: Configure the events as below: http://letsraiseourvoice.in/2014/03/creating-simple-awe.html 5/20 .blogspot.

Approval Process Setup Before Creating the Approval Process .we are creating a userlist of all the users having the role FIN_OFFCR as shown below.html 6/20 . . http://letsraiseourvoice. Userlist defines the list of user who will be getting the notification when some event triggers.in/2014/03/creating-simple-awe.blogspot. This can be created as below. Here . 7. we need to setup USERLIST which is required. Please note that bind variable %1 is used by AWE and it means the URL pointing to the transaction. Configuring AWE .8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) We need to pass email template to the AWE workflow .

in/2014/03/creating-simple-awe.one path and one step in the setup. http://letsraiseourvoice.html 7/20 . we are creating approval process of only one step.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Adding the Approval Process Setup. Since. We will create only one stage.blogspot.

blogspot.html 8/20 . Click on Alert Criteria and set it as Always true. http://letsraiseourvoice.in/2014/03/creating-simple-awe. Click on Path Criteria and set it as Always true.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Click on Definition Criteria and set it as Always true.

8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Click on Step Criteria and set it as Always true. Click on Save: 8. So a tick is appearing in each criteria link. Criteria are used to determine whether to enter a path. All Criteria is now set. http://letsraiseourvoice.blogspot.html 9/20 .stage or not. Coding the workflow.step.in/2014/03/creating-simple-awe.

Similar is the case for DoDeny(). For launching AWE workflow we need to call the DoSubmit() method of the EOAW_CORE:LaunchManager class. The best place to trigger AWE events are at SavePostchange as all the validations are done by that point. Declare Function createStatusMonitor PeopleCode EOAW_MON_WRK. it launches the AWE workflow. Lets code that when user clicks on Submit . When the Approver . import EOAW_CORE:ApprovalManager.html 10/20 .EOAW_FC_HANDLER FieldFormula. we assign the variable &c_apprAction as "S".in/2014/03/creating-simple-awe. approves the request it completes the workflow as approved and vice versa. Approve button as "A" and Deny button as "D".blogspot. http://letsraiseourvoice. Below is the code: import EOAW_CORE:LaunchManager. For Approving the running Workflow the DoApprove() method has to be called. We have written the code on buttons but we still have not launched the AWE. Approve and Deny. Lets writewhen the user clicks the submit button.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) We had three Push buttons : Submit .

blogspot. When "A" &c_aweApprManager.in/2014/03/creating-simple-awe. http://letsraiseourvoice. "D". When "D" &c_aweApprManager. Break.html 11/20 . %OperatorId). import EOAW_CORE:LaunchManager. Break. Component EOAW_CORE:LaunchManager &c_aweLaunchManager. &c_aweApprManager = create EOAW_CORE:ApprovalManager(&c_aweLaunchManager. If (&c_aweLaunchManager. End-If. Component EOAW_CORE:ApprovalManager &c_aweApprManager. Evaluate &c_apprAction When "S" &c_aweLaunchManager. Local Record &headerRec = GetRecord(Record.DoSubmit().T_HEADER). False). End-If. Local boolean &isApprover.EOAW_FC_HANDLER FieldFormula.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Component string &c_apprAction. If &c_aweApprManager. createStatusMonitor(&c_aweApprManager.the_inst. Null.txn.DoDeny(&headerRec). &headerRec. End-Evaluate. import EOAW_CORE:ApprovalManager. Adding the Approval Monitor Page: Postbuild Code. Declare Function createStatusMonitor PeopleCode EOAW_MON_WRK. Component EOAW_CORE:LaunchManager &c_aweLaunchManager.hasPending.awprcs_id. Component EOAW_CORE:ApprovalManager &c_aweApprManager.hasAppInst) Then REM ** Initialize Approval Manager if transaction was submitted. Break. REM ** Component scoped AWE Approval Manager for approve/deny.DoApprove(&headerRec).hasAppInst Then &isApprover = &c_aweApprManager.

1). False). createStatusMonitor(&c_aweApprManager.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Component string &c_apprAction.definition = "SHARE". &headerRec.hasAppInst Then &isApprover = &c_aweApprManager. ApprovalManager will * need reinitialization on submit */ &c_aweLaunchManager = create EOAW_CORE:LaunchManager(&PROCESS_ID. %OperatorId). /* Uncomment the following line if you don't want AWE to choose the * Definition Id based on the preconfigured definition criteria. Approval Component. "D". Null. EOAW_IDS defines a number from which AWE will start creating threads. Same as emplid. We should not change this value once it is setup.hasPending. &headerRec.html 12/20 . EOAW_IDS: Last but not the least. This can cause multiple transactions to end up with the same keys. It requires a manual insert SQL.in/2014/03/creating-simple-awe. End-If.the_inst. Lets add a new Asset id for approval. * Definition criteria is maintained using the "Setup Process * Definition" component. you can initialize your workflow with some number and then AWE will take care of incrementing it and maintaining it with your transactions. Local Record &headerRec = GetRecord(Record. Constant &PROCESS_ID = "ASSET_APPROVAL". http://letsraiseourvoice.T_HEADER). we need to setup EOAW_ID for our workflow. */ &c_aweLaunchManager.blogspot. EOAWCOUNTER)VALUES ('APT_WA_AWE_XREF'. %OperatorId). If &c_aweApprManager. &c_aweApprManager = create EOAW_CORE:ApprovalManager(&PROCESS_ID. In HCM its is similar to what will be the first Emplid and it will be then incremented with each emplid creation. 9. /******** PostBuild mainline code ********/ /* Initialize the launch and approval managers. INSERT INTO PS_EOAW_IDS(EOAWCOUNTERNAME.

APPROVE_BTN.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) We still have all the three buttons on the page which we need to control. So.in/2014/03/creating-simple-awe. End-If.now the buttons are displaying correctly.SUBMIT_BTN.Visible = True. You may add it in the header record and use it on the page.Visible = True. Criteria will be discussed in later chapters. We can write a small piece of code checking if the workflow has started or not. Postbuild code: If &c_aweApprManager. We can make use of the "hasappinst" property of the Approval Manager object which we used to display Approval Monitor Earlier. T_BUTTONS. Since this field is going to be a non key . Let us add the currency code field on the page. http://letsraiseourvoice.APPROVE_BTN.blogspot.hasAppInst Then T_BUTTONS. T_BUTTONS. if not show SUBMIT button else show Approve and Deny button. this is not going to impact to workflow and we can add it without issues. T_BUTTONS.Visible = True. Let's go ahead and submit a request for this Asset.Visible = False.Visible = False.DENY_BTN. The submit button should only be visible for the requester and Approve and Deny button should be visible for the Approver. One thing I missed was to include a currency code field in the page which tells the amount's Currency.Visible = False.DENY_BTN. T_BUTTONS.html 13/20 . This will be also useful when we define a 'Criteria' on monetary basis because you cannot have a monetary criteria without currency code. Else T_BUTTONS.SUBMIT_BTN.

Lets submit a request for an asset Click on Submit Wooow.blogspot.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) So our page now looks like below: Now is the time to test our workflow.html 14/20 . http://letsraiseourvoice.in/2014/03/creating-simple-awe. you can see a the approval monitor below.

html 15/20 .in/2014/03/creating-simple-awe. Click on the Approve button: http://letsraiseourvoice. our workflow has triggered. We see the worklist in KUTL101 inbox .8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) It means. Logging as KUTL101. that means our workflow has triggered. The approval monitor shows that it is pending with finance officer KUTL101.blogspot. Lets go ahead and Approve the request. Lets log in as KUTL101 and see if there is any worklist created for this request.

OnHeaderApprove +/ %This. "X"). I have created a app package and inserted a class in the package. method OnHeaderDeny(&userinst As EOAW_CORE:ENGINE:UserStepInst). The class extends the EOAW_CORE classes and update the "Status" field as approved or Denied according to the approver selection.thread.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) We have successfully completed the AWE workflow. end-class. Lets go on create an event handler class which update the status of the status field as "Approved" when the request is approved. &status As string).blogspot. method UpdateStatus /+ &thread as EOAW_CORE:ENGINE:Thread. This is because AWE does is not aware of this field .thread. The Eventhandler class comes into picture in scenario like this where we want to do some stuff on AWE events. method OnHeaderDeny /+ &userinst as EOAW_CORE:ENGINE:UserStepInst +/ /+ Extends/implements EOAW_CORE:ApprovalEventHandler. "D"). end-method. import TRAVERSEALLFIELDS:DisableFields. method componentDisplayOnly(&Rs As Rowset).OnHeaderDeny +/ %This. class WebAssetAppr_EventHandler extends EOAW_CORE:ApprovalEventHandler method OnHeaderApprove(&appinst As EOAW_CORE:ENGINE:AppInst). +/ /+ &status as String +/ http://letsraiseourvoice.html 16/20 .UpdateStatus(&userinst. private method UpdateStatus(&thread As EOAW_CORE:ENGINE:Thread. import EOAW_CORE:ENGINE:UserStepInst.UpdateStatus(&appinst.in/2014/03/creating-simple-awe. method OnHeaderApprove /+ &appinst as EOAW_CORE:ENGINE:AppInst +/ /+ Extends/implements EOAW_CORE:ApprovalEventHandler. import EOAW_CORE:ApprovalEventHandler. import EOAW_CORE:ENGINE:Thread. import EOAW_CORE:ENGINE:AppInst. end-method. The approval monitor is showing the transaction to be approved but still the status at the top right corner is showing as pending.

CopyFieldsTo(&asset_rec).In that case the ususal page class peoplecode.in/2014/03/creating-simple-awe.displayonly won't be affective and it will make buttons and hyperlinks also disabled and you can not change it via peoplecode. More detail of this method can be find in this link.ChildCount %This.RecordCount For &k = 1 To &Rs(&i). Now we need to modify the Transaction Registry to include this Event Handler. end-method. For &i = 1 To &Rs. End-For.GetRowset(&j)). method componentDisplayOnly /+ &Rs as Rowset +/ Local number &i. end-method. End-For.ActiveRowCount For &j = 1 To &Rs(&i).GetRecord(&j).GetRecord(&j).rec contains the cross reference record which has * header record keys*/ &thread. &j. but we are * using a sibling record so we have to hard code the record name */ Local Record &asset_rec = CreateRecord(Record. http://letsraiseourvoice. For &j = 1 To &Rs(&i). &asset_rec.DisplayOnly = True.html 17/20 .FieldCount &Rs(&i).rec.GetField(&k). End-For.Refresh().SelectByKey().8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) /* &thread.T_HEADER).APPROVAL_STATUS).componentDisplayOnly(GetLevel0()). GetLevel0().GetField(Field. This function uses recursive method to loop throught each field in the component and makes them displayonly.Update().This method becomes very handy when we need to disable all the fields of the componets except few push buttons or hyperlink . &k. &asset_rec.componentDisplayOnly(&Rs(&i). page. /* &thread. End-For.Value = &status.blogspot. %This.recname contains the header record name. You might have notice that I have created a method "ComponentDisplayOnly" to make all the fields disabled once the user Approves or Deny the request. &asset_rec.

Well Done *************************************************************************** Posted by Saiyed Parwez at 8:50 AM http://letsraiseourvoice.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) Save the page.in/2014/03/creating-simple-awe. So the code is working as expected.html 18/20 . Lets submit a request again.blogspot.

PathInst.the_inst.ENGINE. /* ERROR OBSERVED */ Invalid SQLExec update for this type of PeopleCode program.ENGINE.!! .AdHocStepInst. (2.OnExecute Name:SaveAdHocs Statement:60 Called from:EOAW_CORE.Saiyed • Reply • Share › Joe Kidd • 3 months ago For AdHoc approval while reviewing a transaction..html 19/20 .COM/ Peoplesoft Beginners to Expert: Parallel Processing with Application Engine Peoplesoft Beginners to Expert: Installing PeopleSoft on Windows Laptop..ENGINE. Null.. Moved the code back to Button FieldChange and it works fine..I have created a custom table where I hold … file without a support identifier.. had mistakenly pasted my code in FieldFormula rather than in the FieldChange..StageInst. • Reply • Share › Anonymous • 5 months ago Good stuff. I understand we need to launch the ApprovalManager object as follows with the parameter "A" for add and not "D" for display: createStatusMonitor(&approvalMgrObj.OnExecute Name:Save PCPC:1171 Statement:27 Called from:EOAW_CORE.Save().. -Joe • Reply • Share › saiyedparwez Mod Joe Kidd • 3 months ago Glad to know that it worked. am getting an error on executing the following code: &approvalMgrObj. False)..ENGINE. "A". • Reply • Share › Anonymous • 5 months ago Excellent work.8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) 6 Comments http://letsraiseourvoice... DoSave().blogspot...StepInst. Subscribe Add Disqus to your site Newer Post Home Subscribe to: Post Comments (Atom) http://letsraiseourvoice.OnExecute Name:SaveAdHocs Statement:294 Called from:EOAW_CORE.. Subsequently when trying to save the newly added approver/reviewer with the standard "Apply Approval Changes" using the following.the_inst.. 6 comments • 4 months ago 6 comments • 2 months ago saiyedparwez — If you see the blog in detail.ENGINE. Thank you! • Reply • Share › WHAT'S THIS? ALSO ON HTTP://LETSRAISEOURVOICE..146) EOAW_CORE.OnExecute Name:SaveAdHocs Statement:41 see more • Reply • Share › Balakrishna • 5 months ago Really very good stuff for begginners.in/2014/03/creating-simple-awe.blogspot.OnExecute Name:SaveAdHocs Statement:47 Called from:EOAW_CORE.you will saiyedparwez — I don't think you can download the ova note that I have divided the data according to deptid.AppInst.com/ Login 1 Sort by Best Share Favorite Join the discussion… Joe Kidd • 3 months ago Sorry for the earlier post.BLOGSPOT.

in/2014/03/creating-simple-awe.blogspot.html 20/20 .8/21/2014 Peoplesoft Beginners to Expert: Creating a Simple Workflow with AWE(Approval Workflow Engine) http://letsraiseourvoice.