Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

1. What is Forms Personalization


Form Personalization is a feature that allows us to change the behavior of Oracle Forms-
based screens, including changing properties, executing built-ins, displaying messages,
adding menu entries, launching URLs . It is purely declarative in nature.

2. What are the benefits of Forms Personalizations when compared to CUSTOM.pll


No compilation is necessary to make forms personalizations take effect
Multiple users can develop forms personalization at any given point in
time.
It is fairly easy to enable and disable forms personalizations.
A programmer is not required to do simple things such as hide/disable
fields or buttons.
Provides more visibility on customizations to the screen.
Personalizations survive patches but you must retest your personalizations every time a patch is
applied.

3. Common Forms Personalizations


In this section we will go over some of the most commonly done Forms
Personalizations. Each personalization will be carried out giving clear step by step
instructions. All personalizations will be carried out on the AP Invoice Workbench
Form. This form is generally available from
Payables ManagerInvoices:EntryInvoices
I. Changing prompts through Personalization
Step 1: Open up the Invoice Entry Form from the navigation shown above. You
must see this form

Step 2: In this example we are trying to change the prompt of one of the fields in the Form
to achieve what we need. Access the personalization screen by following the navigation
given in the screen shot below

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 3: You must see the following form. Also please read the explanations given against
each of the fields in the form

The Conditions tab in a forms personalization represents the “if” part of a


personalization i.e. “if all that I am stating here is true” then do something else and this
“something else” is mentioned in the Actions tab which we will cover in the next step.

In this example we are stating that “At sequence 1 I am defining a personalization


which must execute when the triggering event that is fired is “WHEN-NEW-FORM-
INSTANCE” . I will not enter any specific condition as of now since I want my
personalization to fire everytime the form is launched”

Step 4: Now we move to the Actions tab.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 5: Save the personalization. Exit the form and re-launch it and you must see
something like this now.

II. Enabling/Disabling fields through Personalization


Step 1: Let us carry out the enabling/disabling fields in a form personalization on the
Payment Terms form in the Payables Responsibility. Navigation: Payables Manager
SetupInvoicePayment Terms. You should see the following form:

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 2: What we are trying to achieve in this form is that whenever the Description field
is entered as “No Rank” then the Rank field should get disabled

Step 3: Enter the personalization Condition as follows

In order to enter the condition as shown in the screen shot shown above. Follow the steps
below .
Navigate into the Condition box.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Once you click ok in the above box you will get something like :
${item.ap_terms.description.value} in the Condition box. To this add =’No Rank’
Step 4: Now navigate to the Actions tab

Step 5: Now save the personalization . Close the Form and re-launch it again . Try
entering the Description field as No Rank and then navigate to the Rank field and observe
that the field is disabled for insertion

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

In a similar manner fields which are otherwise disabled for update can be enabled by
setting the Insert Allowed property to True
III. Launching URLs through Forms Personalization
Step 1: Open up the Payment Terms form once again. What we are trying to achieve
through this personalization is demonstrated in the screen shot below

Then final result here will be that when the user clicks on the Launch Google menu
item in the Actions Menu the google page must open up. Let us see how this can be
done.
Step 2: Navigate to the Personalizations form. The first thing we have to do is to create
a Menu item in the Actions Menu which can be used as a hook to launch the URL .

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 4: Next let us write a capturing point for this trigger event

SPECIAL:35. It must be noted that all SPECIAL trigger events can be initialized / set
only in the WHEN-NOW-FORM-INSTANCE trigger

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 5: Navigate to the Actions tab

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Save the Personalization. Close the form and re-launch it.


Step 6: Click on ActionsLaunch Google and you must see something like this

IV. How to call PL/SQL code from Forms Personalization


Step 1: In this example we will call a PL/SQL procedure through Forms
Personalizations. We will use the invoice payment terms form like we had in the
previous example.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 2: Before we create a personalization that will call a PL/SQL procedure we need to
create a simple ‘do-nothing’ pl/sql procedure. We will pass one argument to this
procedure to see how values from a Form can be passed into a PL/SQL procedure
through personalization

Step 3: Let us create a dummy PL/SQL procedure first. From your SQL*Plus enter the
following
CREATE OR REPLACE PROCEDURE TEST_PLSQL_FORM_PER (text IN VARCHAR2)
IS
BEGIN
CREATE OR REPLACE PROCEDURE TEST_PERSONALIZATION(p_text_argument_in IN VARCHAR2)
IS
BEGIN
INSERT INTO fnd_log_messages
(module, log_level, MESSAGE_TEXT, user_id, TIMESTAMP,AUDSID
,log_sequence)
VALUES ('AP', 1, p_text_argument_in, fnd_global.user_id, SYSDATE,-99
,fnd_log_messages_s.NEXTVAL);-- This will help us know if the
personalization fired and entered a row into this table. This is a table used for
writing log messages in Oracle Apps
COMMIT;
END TEST_PERSONALIZATION;

Step 4: The first step is to create a menu item to provide us with a hook to call a PL/SQL Procedure.
Open up the personalization form and enter the following personalization rule and actions

Now for the Action

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 5: Next we have to create a personalization to capture SPECIAL39 event.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 6: Now finally save the personalization . Close the form and relaunch it and you
should see something like this

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Step 7: Verify from the fnd_log_messages table that a row has got inserted with the
description we used above.

4. Limitations of Forms Personalizations


Following are the limitations of Forms Personalizations:
New items cannot be created
Items cannot be moved between canvases
Items which are not on a canvas cannot be displayed
Datatype of an item cannot be set
Frames, Boilerplate or Graphics cannot be changed
This feature only responds to events that are supported by APPCORE. These are limited to
 WHEN-NEW-FORM-INSTANCE, WHEN-NEW-BLOCK-INSTANCE,WHEN-NEW-RECORD-
INSTANCE, WHEN-NEW-ITEM-INSTANCE
 WHEN-VALIDATE-RECORD(not in all Forms). This event is generally fired when the current
record in the current block has undergone some change
 Populate tools menu (MENU1-15)
 Populate tools menu (SPECIAL 1-15)
 Populate reports menu (SPECIAL 16-30)
 Populate actions menu (SPECIAL 31-45)

5. Migrating Forms Personalizations


Like all other entities Personalizations can also be imported/exported using FNDLOAD command
To download rules for a particular function
FNDLOAD <userid>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct
<filename.ldt> FND_FORM_CUSTOM_RULES function_name = <function_name>

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

The function name can be seen from the Personalization screen at the top left corner.

To download for a particular form


FNDLOAD <userid>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct
<filename.ldt> FND_FORM_CUSTOM_RULES form_name = <form_name>

To download all personalizations , all forms and all functions


FNDLOAD <userid>/<password> 0 Y DOWNLOAD $FND_TOP/patch/115/import/affrmcus.lct
<filename.ldt> FND_FORM_CUSTOM_RULES

Upload:
FNDLOAD <userid>/<password> 0 Y UPLOAD $FND_TOP/patch/115/import/affrmcus.lct
<filename.ldt>

6. Securing Forms Personalizations


Forms personalization is a very powerful feature and has the capacity to fundamentally alter the behavior
of Oracle Applications, so you would not want everyone to have access to it . We can restrict the users
who have access to by setting the following profiles appropriately

 Set Profile Option Hide Diagnostics menu entry to No


Yes will hide the diagnostics menu.
 Profile Option Utilities: Diagnostics – if set to No, apps

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Hiding a Field Using Oracle Forms Personalization

Create a User
1. Log in as sysadmin/sysadmin and select the System Administrator responsibility. Navigate to the
Users window.
 (N) Security > User > Define
2. Enter a user name: <first initial> <last name>
3. Enter a password twice.

4. Assign the user the Customer Support , Vision Operations or the Service responsibility, depending on
which one you are using in the class.
Normally, you are required to enter an employee resource in the Person field, but we will ignore this
requirement for this practice.

5. Switch responsibility to the Customer Support , Vision Operations or the Service responsibility,
depending on which one you are using in the class.

Find the Field Name of the Addressee Field on the Contact Center’s Address Tab
6. Navigate to the Contact Center.
 (N) Customer Management > Contact Center
7. Select the Addresses tab.
8. Place your cursor in the Addressee field.
9. From the Help menu, choose Diagnostics > Examine.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

10. Enter the password “apps” in the Enable Diagnostics field and click OK. The Examine Field and
Variable Values window appears. The field name is the combination of the Block and Field name
separated with a period ".": ADDRESS.ADDRESSEE

11. Click OK to return to the Contact Center.

Hide the Field for the User Through Oracle Forms Personalization
12. Turn on Forms personalization
 (M) Help > Diagnostics > Custom Code > Personalize
The Form Personalization window appears.
14. Enter a number in the Seq field. To ensure all the numbers in the class are unique, enter: 1<student no.>,
for example: 101.
15. Enter a description. Include the user name to distinguish your personalization from others in your
class: “Hide the address field for user <user name>”
16. Leave the Trigger Event as WHEN-NEW-FORM-INSTANCE and Processing Mode: Not in Enter-
Query Mode.
17. In the Context region enter User as the Level and the user name you created for the Value. This
specifies that your personalization applies only to that one user.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

18. Select (T) Actions – enter the following data:

Field Value
Action Seq 1
Type Property
Language All
Enabled check box selected

19. Enter Item as the Object Type.


20. Use the Target Object List of Values to enter the field name you determined earlier in the practice:
ADDRESS. ADDRESSEE.
21. In Property Name enter: DISPLAYED (APPLICATIONS COVER)
22. For Value enter: FALSE.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

23. Save.
24. Exit Forms by clicking the X close icon on the top right-hand corner of the window and return to the
Home page. This is a separate browser window.
25. Logout of the application by selecting the Logout link.

Test Your Personalization


26. Log in as the user you created.
27. You are prompted to change your password.
28. Navigate to the Contact Center.
 (N) Customer Management > Contact Center
The application displays an error. This is because you did not associate the user with a resource
earlier.

29. Click OK.


30. Select the Addresses tab to view the hidden field.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

How To Disable A Button On A Form Using Forms Personalization


1. Navigate to the Form where the button is to be disabled.

2. Open the Personalization form from the pull down menu Help => Diagnostics => Custom Code =>
Personalize.

3. Implement the following personalization rule :


Sequence: 10
Description: Disable Schedule Option
Level: Function
Enabled: Yes
Trigger Event:WHEN-NEW-FORM-INSTANCE
Trigger Object: Null
Condition: Null
Processing Mode: Not in Enter-Query Mode
Context: User level and set value to your user name.

Actions tab :
Sequence: 10
Type: Property
Object Type: Item
Target Object: WORK_ORDER.SCHEDULE
Property Name: DISPLAYED
Value: FALSE

4. Save your personalization rule and exit the form and re-enter to see the result. You will notice that the
Schedule button on the Submit Request Form is no longer displayed for this specific user. Similar action
can be taken on other buttons as well

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

How to change the height or width of a List Of Values associated with a form?
1.Navigate to the Form which is having the LOV Item
2.Open the Personalization form from the pull down menu Help => Diagnostics => Custom Code =>
Personalize.
3. Implement the following Personalization rule :
Seq: 10
Description: Increase the width of the LOV
Condition:
Trigger Event: WHEN-NEW-FORM-INSTANCE
Trigger Object: Null
Condition: Null
Processing Mode: Both
Context:
Level: Site
Value: Null

Action:
Seq: 10
Type: Property
Description: Width of the LOV
Language: All
Object Type: LOV
Target Object: <Name of the LOV>
Property Name: WIDTH
<Press the button "Get Value" to retrieve the current width of the LOV in the Value field>
Value: <Increase the value for the width>

4.Save the personalization rule.

However please note that to increase the width of a particular column of a LOV user needs to change the
property of the column(Column mapping) for the LOV item from the Forms Builder.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

How to customize a LOV using Form Personalization?

A1:
This Feature is available from RUP3 '11i.ATG_PF.H RUP3' PATCH 4334965
1. Navigate to the Form which is having the LOV Item.

2. Open the Personalization form from the pull down menu:


Help => Diagnostics => Custom Code=>Personalize.

3. Implement the following personalization rule :

Seq: 10
Description: Increase the width of the LOV
Condition:
Trigger Event: WHEN-NEW-ITEM-INSTANCE
Trigger Object: <Name of the text item having the LOV in the Block_Name.Item_Name
format>
Condition: Null
Processing Mode: Both
Context:
Level: Site
Value: Null

Action:
Seq: 10
Type: Builtin
Description: Create Record Group
Language: All
Builtin Type: Create Record Group From Query
Argument: <Custom SQL query to populate the data in the LOV>
[Please note that the number of collumns must be the same
as the seeded record group so that LOV column mapping do
not violate]
Group Name: <Enter some record group name>

Seq: 20
Type: Property
Description: Attach the Record Group to the LOV
Language: All
Object Type: LOV
Target Object: <Name of the LOV>
Property Name: GROUP_NAME
Value: <Name of the Record Group created in the previous action>

-------------------------
Example: Customize the Application Name LOV to populate the Application Name starting with "C" in
the Application Developer > Application > Forms
-------------------------

Seq: 10
Description: Increase the width of the LOV
Condition:

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Trigger Event: WHEN-NEW-ITEM-INSTANCE


Trigger Object: FND_FORM.APPLICATION_NAME
Condition: Null
Processing Mode: Both
Context:
Level: Site
Value: Null

Action:
Seq: 10
Type: Builtin
Description: Create Record Group
Language: All
Builtin Type: Create Record Group From Query
Argument: select APPLICATION_NAME, APPLICATION_ID
from FND_APPLICATION_VL
where APPLICATION_NAME like 'C%'
order by APPLICATION_NAME
Group Name: RG_APPLICATION

Seq: 20
Type: Property
Description: Attach the Record Group to the LOV
Language: All
Object Type: LOV
Target Object: APPLICATION_LOV
Property Name: GROUP_NAME
Value: RG_APPLICATION

4.Save the personalization rule.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

Form Personalization, Call a Function, And Return Value To Screen


In from personalization it is possible to call a database function that retrieves values based on other data
entered on the screen by the user. The function then returns these values to a field on the screen. We can
use a SELECT statement to call the function, put the data entered by user in some fields as required
parameters to the function and finally assign the value returned by the function to a field in the form.
Before doing the exercise, please note the below points:
1] Every property that takes a string can either be processed literally or evaluated at runtime.

2] If you type a string in that does not start with ‘=’, then the exact value you type in will be used at
runtime.

3] If the string you type starts with ‘=’, then the text immediately after that character will be evaluated at
runtime. This allows you to write complex logic that can include references such as:
 SQL operators, such as ||, TO_CHAR, DECODE, and NVL
 Bind variables (:block.field), including: system: global and: parameter values. Use the ‘Add Item…’
button to assist with item names.
 Calls to server-side functions that do not have OUT parameters.

4] To use SELECT statement, you must follow these rules:


 The text must start with ‘=SELECT’
 The column being selected must evaluate to a CHAR, with a length no longer than 2000 bytes.
 Your SELECT statement should only return one row, but if more than one is returned only the value
of the first row will be used.

Here is a simple example using a function in the database that queries values, then a personalization that
sets the value queried. This example is defined in the miscellaneous transactions form (INVTTMTX.fmb)
and passes the Project Information (Project Number, Task Number, Expenditure Type and Expenditure
Org) to the function.

=select xx_getaccount_pkg.main(''||${item.MTL_TRX_LINE.ITEM.value}||'',
''||${item.MTL_TRX_LINE.SOURCE_PROJECT_NUMBER.value}||'',
''||${item.MTL_TRX_LINE.SOURCE_TASK_NUMBER.value}||'',
''||${item.MTL_TRX_LINE.EXPENDITURE_TYPE.value}||'',
''||${item.MTL_TRX_LINE.EXPENDITURE_ORG.value}||'') from dual

Note that the variable in this case is written as “${item.MTL_TRX_LINE.ITEM.value}”. The text
“MTL_TRX_LINE.ITEM.” is the Block and Field where the item number is written. The syntax around the
block and field name ensures that the callout is made to replace the value of the item before passing the

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

text to the function. You can use similar naming for your own fields finding the name of the Block and
Field using Help > Diagnostics > Examine. Also don’t put semicolon (;) after the statement.
Open the form that you want to personalize, then choose Help > Diagnostics > Custom Code >
Personalize. In this case, the miscellaneous transactions form is opened.

Enter the main information about when this personalization will be active.
Use the ‘Validate’ button to test if the syntax of your string is valid. If the evaluation fails, the processing
engine will return an ORA error as if the string had been part of a SQL expression. Otherwise, it will
display the text exactly as it would appear at runtime in the current context.

Enter the action information detailing what the personalization will do. Here select the ‘Property Name’
as VALUE and then put the above sql statement.

Save the changes and test the personalization.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

In this case, the Project Information (Project Number, Task Number, Expenditure Type and Expenditure
Org) is passed from the screen to the database function. The function then derives the GL Account from
the above parameters. The value is then replaced for the Account field on the screen.

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

How to make ‘Customer PO’ a Mandatory field?


For example to have customer PO number as a mandatory field
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER.CUST_PO_NUMBER',REQUIRED, PROPERTY_ON);
end if;
end if;

How to restrict cases for Custom PO field?


For example restricting Lower case in Customer PO field
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER.CUST_PO_NUMBER',CASE_RESTRICTION,
UPPERCASE);
end if;
end if;

How to change the background color for the field ‘Payment Terms’?
For example how to Change the background color to Fuchsia(r255g0b255)
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER.TERMS',BACKGROUND_COLOR,'r255g0b255');
end if;
end if;

For setting background color as Cyan


Cyan - r0g255b255

Colors are created by combination of red, green, blue.


The color can be derived from http://www.geodyssey.com/galileo/namedcolors.html

How to change the prompt for a field?


For Changing the prompt of field Order Number on the Release Sales Order form
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'WSHFRREL' AND block_name = 'RELEASE') then
app_item_property2.set_property ('RELEASE.ORDER_NUMBER', prompt_text, 'Sales
Order Number');
end if;
end if;

How to make a field non editable field but the values needs to be defaulted?
For disabling the field
if (event_name = 'WHEN-NEW-ITEM-INSTANCE') then
if (form_name = 'OEXOEORD' AND block_name = 'ORDER') then
COPY ('Business World', 'ORDER.SOLD_TO');
VALIDATE (item_scope);
app_item_property2.set_property ('ORDER.SOLD_TO', enabled, property_false);
end if;
end if;

The Customer Name field is grayed out but the value is passed by using Copy function.

Based on Tab
Hiding Tab
How to hide Lines Tab in Sales Order form?

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

my_tab_page_id TAB_PAGE;
begin
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
my_tab_page_id := FIND_TAB_PAGE('ORDER_REGIONS.LINE_ITEMS');
SET_TAB_PAGE_PROPERTY(my_tab_page_id,VISIBLE,property_FALSE);
end if;
end if;

Renaming Tab

How to rename ‘Lines’ tab to XX Items tab?


my_tab_page_id TAB_PAGE;
begin
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
my_tab_page_id := FIND_TAB_PAGE('ORDER_REGIONS.LINE_ITEMS');
SET_TAB_PAGE_PROPERTY(my_tab_page_id,LABEL,'XX Items');
end if;
end if;

Based on Button
How to hide Book Order Button?
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER_CONTROL.BOOK_ORDER',displayed,
PROPERTY_false);
end if;
end if;

For example to hide Book button on the Sales Order Form

How to Rename Book Order Button?


if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD') then
app_item_property2.set_property('ORDER_CONTROL.BOOK_ORDER',Label,'Please
confirm');
end if;
end if;

Based on Blocks
How to make a block read-only ?
if (event_name = 'WHEN-NEW-FORM-INSTANCE') then
if (form_name = 'OEXOEORD'and block_name = 'ORDER') then
set_block_property(block_name, insert_allowed,property_false);
end if;
end if;

Validations
How to ensure user enters not more than 3 characters in ‘Customer PO’ field and exits the field ?
if (form_name = 'OEXOEORD') then
if LENGTH(name_in('ORDER.CUST_PO_NUMBER'))>3
and
GET_ITEM_PROPERTY('ORDER.CUST_PO_NUMBER',UPDATE_COLUMN) = 'TRUE'
then
V_REC_NUM := name_in('SYSTEM.CURSOR_RECORD');

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

SET_RECORD_PROPERTY(V_REC_NUM,'INV_SUM_FOLDER',STATUS,NEW_STATUS);
fnd_message.set_name('FND','PO Number must be <= 3 characters');
fnd_message.Error;
RAISE FORM_TRIGGER_FAILURE;
end if;
end if;

Based on Users
How to prevent a particular user from entering an Odd quantity for a particular item?
b := fnd_profile.VALUE ('user_id');
if (b = '1008697') then
if (event_name = 'WHEN-VALIDATE-RECORD') then
if (form_name = 'OEXOEORD' AND block_name = 'LINE') then
if (NAME_IN ('LINE.ORDERED_ITEM_DSP') = 'AS54888') then
if (MOD (NAME_IN ('LINE.ORDERED_QUANTITY'), 2) = 0) then
fnd_message.set_string ('Even quantities for '
||NAME_IN(LINE.ORDERED_ITEM_DSP)|| ' not allowed');
fnd_message.show ();
RAISE form_trigger_failure;
end if;
fnd_message.set_string('Entered quantity is Odd -- so no problem');
fnd_message.show();
end if;
end if;
end if;
end if;

On entering even number

on entering odd number. Navigation to next line allowed only on entering odd number

Zoom
How to enable Zoom for a particular form?

For example to open the Onhand Quantity from Item Description field in lines tab of Sales Order form
To enable the Zoom function
FUNCTION zoom_available
RETURN BOOLEAN
IS
form_name VARCHAR2 (30) := NAME_IN ('system.current_form');
block_name VARCHAR2 (30) := NAME_IN ('system.cursor_block');
BEGIN
if (form_name = 'OEXOEORD' AND block_name = 'LINE') then
RETURN TRUE;
else
RETURN FALSE;
end if;
END zoom_available;

Following code helps to Onhand Quantity Form and to pass the item name to Onhand Quantity from
Sales Order Form and navigate to Item field while clicking the Zoom button.
procedure event(event_name varchar2) is
param_to_pass1 VARCHAR2 (255);
b varchar2(20);
begin
if (event_name = 'ZOOM') then
if (form_name = 'OEXOEORD' AND block_name = 'LINE') then
param_to_pass1 := NAME_IN ('LINE.ORDERED_ITEM_DSP');

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

fnd_function.EXECUTE (function_name => 'INV_INVMATWB',


open_flag => 'Y',
session_flag => 'Y',
other_params => 'ITEMS="' ||
param_to_pass1 || '"' );
end if;
end if;
if (event_name = 'WHEN-NEW-RECORD-INSTANCE') then
if (form_name = 'INVMATWB' AND block_name = 'MATERIAL_QF') then
b := fnd_profile.VALUE ('user_name');
fnd_message.set_string (NAME_IN ('parameter.ITEMS')||'is entered by user' ||b);
fnd_message.show ();
GO_ITEM ('MATERIAL_QF.ITEM');
COPY (NAME_IN ('parameter.ITEMS'), ('MATERIAL_QF.ITEM'));
VALIDATE (item_scope);
END IF;
end event;

At header level zoom button is not active

At line level zoom button will be active

After entering an item, click the zoom button to open the Onhand Quantity Form, the form will ask for
organization to be selected

Item name will be passed to Onhand Quantity Form, The message will be displayed mentioning the item
and the user name passed by the user.

The onhand quantity form will be opened with item description and cursor will navigate to Item field in
Onhand Quantity Form.

Special
How to enable a Special button?
Below is an example showing the menu button from sales order form
a menuitem;
Begin
a := FIND_MENU_ITEM ('SPECIAL.SPECIAL15');
if (event_name = 'WHEN-NEW-BLOCK-INSTANCE') then
if (form_name = 'OEXOEORD' AND block_name = 'LINE') then
app_special2.instantiate ('SPECIAL15', 'Query Form');
SET_MENU_ITEM_PROPERTY (a, displayed, property_true);
SET_MENU_ITEM_PROPERTY (a, enabled, property_true);
end if;
end if;
if (event_name = 'SPECIAL15') then
if (form_name = 'INVIDITM') then
fnd_function.EXECUTE (function_name => 'INV_INVMATWB',
open_flag => 'Y',
session_flag => 'Y' );
end if;
end if;

How to switch off the custom code at the run time?

RAJU CHINTHAPATLA
FORMS – Oracle Forms Personalization Training Manual Raju Chinthapatla

This is similar to switching off the custom code using Help --> Diagnostics --> Custom --> Custom Off
Note: Switching off customization means that Codes written in custom library and for personalization are
switched off. This does not switch off Custom triggers or Custom code written on the standard forms.

A sample code for switch off customization:


IF event_name = 'WHEN-NEW-FORM-INSTANCE' THEN
IF fnd_profile.value('USER_ID') =1318 THEN
copy ( 'OFF' , 'GLOBAL.APP_CUSTOM_MODE' ) ;
ELSE
copy ( 'NORMAL' , 'GLOBAL.APP_CUSTOM_MODE' ) ;
END IF ;
END IF ;

RAJU CHINTHAPATLA

You might also like