Previous Topic: Call the Edit Request Widget Using Menu OptionsNext Topic: Call the Request List Widget Using Menu Options


Call the Edit Request Widget Using Source Code

In Liferay, you can call the Edit Request widget by creating the portlet and specifying the source code. Review the following steps for producing the earlier Edit Request widget example. Follow them as a model to configure the display and behavior of the Edit Request widget in your implementation.

Follow these steps:

  1. On the portal page, perform these actions to create the portlet:
    1. Click Add, Web Content Display.
    2. Click the plus icon (Add, Web Content).

      The New Web Content window appears.

    3. Specify the required fields and close the window.

    The new portlet gets added to Liferay.

  2. Click Edit Controls at the top of the page.
  3. Mouse-over the portlet, and click the pencil (Edit Web Content) icon.

    The portlet Settings appears.

  4. In the Content window, click Source.

    The Source container opens for editing.

  5. Review the following source and key parameters for the earlier Edit Request widget example. Use them as a model to specify your source.
  6. Perform the following actions:

Source and Key Parameters

The source for the Edit Request widget example follows:

<script type="text/javascript" src="http://hostname:portnumber/usm/gwt/fdRenderer/fdRenderer.nocache.js"></script>
<script type="text/javascript" language="javascript" src="http://hostname:8080/usm/explorer/scripts/edit.request.widget.js">
<script> CA_Catalog.buildWidget({ type: 'edit.request', renderTo: 'targetDiv', login credentials, businessUnit:"London222",  rootId: -1, linkColor: 'inherit', borderColor: 'darkGreen', layout:'layout-8', openIn:'_self'}); </script>
<div align="left" id="targetDiv" style="margin-bottom: 10px;">
	&nbsp;</div>

The first line references the form renderer required for the Edit Request widget.

The second line references the JavaScript file for the Edit Request widget.

The third line specifies the JavaScript with configuration parameters for the Edit Request widget.

Note: Separate parameters with a comma, but do not specify a comma after the last parameter.

The fourth line specifies the DOM element in which the Edit Request widget is rendered.

Key parameters and explanations follow for the CA_Catalog.buildWidget function call in the Edit Request widget example.

login credentials

We recommend single-sign-on for widgets. However, if you require login credentials for this widget, specify them in this function call. Use the following format:

username: 'username', password: 'password'
type:"edit.request"

Specifies that the widget is an Edit Request widget.

renderTo:"targetDiv"

Specifies that the widget is rendered into the DOM element whose ID is targetDiv.

businessUnit:"London222"

Specifies the business unit that catalog users can access while utilizing this Edit Request widget. Users can edit requests in all folders in this business unit.

For example, if you specify the root business unit, users can edit requests in all folders in all business units, including the root business unit. Conversely, if you specify the lowest level business unit, users can edit requests from that business unit only.

If you do not specify a value, the Catalog system uses the default business unit of the user accessing the widget.

rootId:–1

Specifies that when the Request List widget opens initially, it displays nothing.

As soon as the user clicks an option on the Status widget, the Request List widget displays the matching item: the cart, open requests, completed requests, or requests pending action.

Note: If you specify a request, it must exist in a business unit that the user can access, as explained in the businessUnit parameter.