Friday 3 January 2014

Creating Menu items with Forms Personalization


Menu items can be added to forms using personalization to add functionality to the form that can be invoked as and when required by the user.
As part of one requirement we had to give the user the option of initiating a workflow after making a change on the Supplier form. We created a menu item using personalization for the users to click and initiate the workflow. The personalization steps are given below
 
Open the Supplier form
Responsibility: Payables Administrator
Navigation: Suppliers > Entry
Supplier form
Navigate to Help > Diagnostics > Custom Code > Personalize
Condition
Personalize
Seq: Next available
Description: Create Menu Item – Nshore 69658
Trigger Event: When-New-Form-Instance
Trigger Object:
Condition: ${ps.org_id.value} NOT IN (103, 4763) – We do not want the personalization for 2 orgs
Processing Mode: Both
 
Actions
Action
Seq: 10
Type: Menu
Description: Create menu item
Language: All
Menu Entry: Special3
Menu Label: Approve Site
Icon Name:
Enabled in Block(s): SITE, SITE_USES
The menu item is created so far. Now we have to add logic/code to the menu item. All Menu entries of named as SPECIAL are shown in the Tools menu bar on the form.
 
Condition
Add condition
Seq: <<Any number>>
Description: Add code to Menu Item – Nshore 69658
Trigger Event: Special3
Trigger Object:
Condition:





xxey_ost_vendor_approval_pkg.chk_existing_wf (
xxey_ost_vendor_approval_pkg.generate_user_key(${item.vndr.vendor_id.value},
${item.site.vendor_site_id.value}, NULL, NULL)) = 0
AND ${ps.org_id.value} NOT IN (103, 4763)
AND ${item.site.inactive_date.value} IS NOT NULL
Processing Mode: Not in Enter-Query Mode
The condition calls a packaged function, xxey_ost_vendor_approval_pkg.chk_existing_wf, to check if a running workflow exists for a supplier or not.
 
Actions
Action to initiate workflow
Seq: 10
Type: Builtin
Description: Execute workflow
Language: All
Builtin Type: Execute a procedure
Argument:















='begin
xxey_ost_vendor_approval_pkg.start_wf
('''||
:SYSTEM.CURRENT_FORM
|| ''',''' ||
${item.vndr.vendor_id.value}
|| ''',''' ||
${item.site.vendor_site_id.value}
|| ''',''' ||
NULL
|| ''',''' ||
NULL
|| '''
);
end'
The code in the argument is calling the packaged procedure, xxey_ost_vendor_approval_pkg.start_wf, after passing the parameters from the Supplier Site form, to initiate the workflow.
Action to show message to user
Seq: 15
Type: Message
Description: Show message to user
Language: All
Message Type: Show
Message Text: = Approval has been sent to approver.
After the workflow has been initiated a message is shown to the user.
Usage of the personalization
Responsibility: Payables Administrator
Navigation: Suppliers > Entry
Supplier form showing menu item
Notice the new menu item, “Approve Site”. This was created through personalization. Also note that on the Supplier master block the menu item is disabled as we have set the personalization on the Site block and Site Uses block.
Click on Sites button
Item is enabled on Supplier Site form
Click on Approve Site menu item
Message to user after workflow initiation
The user gets a message as part of Action 2, after Action 1 is executed, i.e. after the workflow has been kicked off.

No comments:

Post a Comment