July 13th, 2007
In a previous article, I discussed some of the advantages to using Personalizations within Oracle forms by demonstrating how to validate field data in the Sales Order form within Order Management. I’d like to further demonstrate some of the advanced features of Forms Personalizations by solving a problem that is frequently encountered within the Oracle development community – how to prompt and force the selection of inventory organization when entering a form.
I encountered this requirement from a client implementing Order Management and Project Manufacturing. One aspect of Project Manufacturing is enabling project-task stock location. The stock locator field in itself is a key flexfield that is context sensitive based on inventory organization, but enabling the project and task segments adds additional dependency on the inventory organization context because the SQL validation that is tied to these segments makes reference to the organization. So in theory, based on this design, all
However, there are a number of standard forms in Oracle, such as the Release Sales Orders form in Shipping Execution, where a reference to the stock locator field is made but does not require an inventory organization selection. If a user enters this form without performing the “Change Organization” function, strange behavior would result that would prompt the stock locator flexfield window and prevent the user from being able to submit the Pick Release process.
As a work-around solution, I instructed the users to perform the “Change Organization” prior to entering the Release Sales Order form so the key flexfield issue could be avoided, but it still continued to be a nuisance as it was easy to forget to perform this step – unless I could somehow require that the organization be selected prior to entering the form. Somehow I needed to replicate the functionality of standard Oracle forms such as Organization Items, Miscellaneous Transactions, etc. where the “Change Organization” prompt is triggered and forces selection of an inventory organization prior to entering these forms.
Through Form Personalizations, I knew that the ability to trigger actions upon entry into a form existed by setting the Personlization condition to “WHEN-NEW-FORM-INSTANCE”.
However, how would I be able to prompt the “Change Organization” form under this condition?
Under the “Actions” tab, one of the options under the “Type” field is “Builtin”, which allows for reference to database and/or form level functions. Once “Builtin” is selected, the right-side display of the form will change and present additional options for “Builtin Type” that includes options for launching SRS forms, functions, URL’s, custom procedures, etc. Since “Change Organization” in itself is a form function, the “Launch a Function” option appears to be the appropriate option.
Next, we need to select the exact Form to trigger during the “WHEN-NEW-FORM-INSTANCE” condition. If you scroll through the list of values you’ll notice that every form in existence is available to choose from. How can we identify the exact Form function to call? If you’re familiar with menu structures within System Administrator, this can be an easy question to answer by opening Application > Menu and querying the menu which contains the “Change Organization” option. But be sure you’re looking at the correct menu. For example, the “Change Organization” form within Order Management set’s an entirely different profile than, say, the “Change Organization” within Purchasing. So in my case, since I need to prompt for organization in Shipping Execution, I need to refer to the “WSH_MAIN_MENU” menu to reference the correction function.
Once you have the menu open, scroll the options until you find the menu prompt named “Change Organization”, than reference the function. Under the “WSH_MAIN_MENU” menu, the function for prompting organization is “Change Organization – CST”.
I got it! Now I can go back to my personalization and make reference to this function.
Going back to the Actions tab of our Personalization where we selected an Object Type of “Builtin” and Procedure Type of “Form”, we can enter “Change Organization – CST” as the function reference. Be sure to save your changes.
Are we done yet? – not quite. Let’s revert back to our “WHEN-NEW-FORM-INSTANCE” condition. Do we always want to prompt for an inventory organization when entering the form? Or do we want to prompt for an organization only if the organization hasn’t been specified in the user’s session? To be safe, let’s add to our condition a check to make sure that the organization setting is NULL before prompting the “Change Organization” window.
Per Metalink note 437830.995, the result of a “Change Organization” sets the MFG_ORGANIZATION_ID profile, and to obtain this value, we must call the seeded FND_PROFILE.VALUE() package and procedure. So if we only want to prompt for organization if this profile hasn’t been set, we should add a condition which checks to see if the MFG_ORGANIZATION_ID is NULL utilizing the seeded package like such:
Now we’re finished. After validating our Form Personalization, we must exit all forms and return to the Navigator in order for our new Personalization to take affect. Upon entering the Release Sales Orders form we find that we’re prompted with the “Change Organization” form. It worked!
Now that we’ve selected the organization, we should be able to exit the form, and re-enter without being prompted since we selected the organization previously. Going back into the Release Sales Orders form, we find that this is the case.
Pretty sweet, eh? Utilizing Form Personalizations, we were able to easily customize our form to enforce an inventory organization to be selected without any need to open the Form .FMB file nor the CUSTOM.PLL.