+

Search Tips   |   Advanced Search

Using remote actions

Remote actions are used to trigger actions from the IBM Web Content Manager application.

We can reference remote actions using plugin tags using the following format:

[plugin:RemoteAction action=" " docid=" " 
dialog=" " dialogSize=" " dialogTitle=" " useCurrentContext=" " showInfoMsg=" " ]

action

This is the remote action to perform.

docid

This is the document ID of the item to run the remote action against.

useCurrentContext

If true, then the document ID is obtained form the rendering context instead of the docid attribute.

dialog

If true, when rendered within a web content viewer portlet the remote action is rendered as a URL that redirects the user to a hidden portal page used by the web content viewer for inline editing.

dialogSize

This optional setting defines the size of the dialog executing the remote action. The value must be in the format "width,height". For example, dialogSize="200,300" for a dialog of width 200 pixel and a height of 300 pixel. If omitted, the dialog size is calculated from the content displayed in the dialog. This setting is only used if dialog="true".

dialogTitle

This optional setting sets the title of the dialog executing the remote action. If omitted, the action name is used instead. This setting is only used if dialog="true".

showInfoMsg

Set this to true to display success status and other information messages after the remote action has finished. If omitted, this parameter is set to false and only warning and error status messages are displayed. This setting can only be used if dialog="true".

Remote actions can also be appended to the URL of an authoring portlet. For example:

http://[host]/wps/myportal/wcmAuthoring?wcmAuthoringAction=action&param=value
You can also append remote actions to the URL of a local web Content Viewer portlet. This can be useful in sites that feature inline editing of content items.

Custom authoring interfaces: There are limitations to the functionality delivered using remote actions. For example, remote actions only support plain text. We cannot use remote actions to add markup into elements such as HTML elements. To create custom authoring interfaces, use the Web Content Manager API in combination with remote actions.

Each web content item can be identified by a DocumentId. The "docid" can be retrieved using the web content API. In the following examples, the value of the "docid" parameter should be the DocumentId as retrieved using the DocumentID.getID() API method. A document ID consists of a document type and a unique ID. The "docid" values provided in the examples are placeholders for real document IDs. For example, com.ibm.workplace.wcm.api.WCM_Content/ID1


Remote action types

new

This is used to open a new item form. You must also specify a "type" parameter. For example:

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" ]

The following type parameters can be used:

  • com.ibm.workplace.wcm.api.WCM_ContentTemplate
  • com.ibm.workplace.wcm.api.WCM_SiteAreaTemplate
  • com.ibm.workplace.wcm.api.WCM_Category
  • com.ibm.workplace.wcm.api.WCM_Content
  • com.ibm.workplace.wcm.api.WCM_DateComponent
  • com.ibm.workplace.wcm.api.WCM_FileComponent
  • com.ibm.workplace.wcm.api.WCM_HTMLComponent
  • com.ibm.workplace.wcm.api.WCM_ImageComponent
  • com.ibm.workplace.wcm.api.WCM_NumericComponent
  • com.ibm.workplace.wcm.api.WCM_PresentationTemplate
  • com.ibm.workplace.wcm.api.WCM_Project
  • com.ibm.workplace.wcm.api.WCM_ProjectTemplate
  • com.ibm.workplace.wcm.api.WCM_RichTextComponent
  • com.ibm.workplace.wcm.api.WCM_ShortTextComponent
  • com.ibm.workplace.wcm.api.WCM_SiteArea
  • com.ibm.workplace.wcm.api.WCM_Taxonomy
  • com.ibm.workplace.wcm.api.WCM_TextComponent
  • com.ibm.workplace.wcm.api.WCM_Workflow
  • com.ibm.workplace.wcm.api.WCM_WorkflowStage

When creating a new content item or site area, we can specify an authoring template by providing the document ID of the authoring template in the atid parameter:

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" atid="com.ibm.workplace.wcm.api.WCM_ContentTemplate/ID1"]

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_SiteArea" atid="com.ibm.workplace.wcm.api.WCM_SiteAreaTemplate/ID2"]

If no authoring template is specified for a new site area, the default site area template is used.

When creating a new project, we can specify a project template by providing the document ID of the project template in the atid parameter:

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Project" atid="com.ibm.workplace.wcm.api.WCM_ProjectTemplate/ID1"]

If no project template is specified for a new project, the default project template is used.

When creating a new site area or project, we can add a atselection="true" parameter to allow users to select a template themselves:

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_SiteArea" atselection="true"]

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Project" atselection="true"]

When creating content items, if no content template is specified, users will automatically be prompted to select a content template.

When creating site areas, taxonomies, authoring templates, presentation templates, component types and workflow items, we can specify the library to save the new item under using the library parameter:

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Taxonomy" library="ABC"]

If the library is not specified in the URL, it will be set as the current library, which can be set using the API method Workspace.setCurrentDocumentLibrary(). If the current library is not set, the default library will be used, as set using the defaultLibrary property in the WCMConfigService.

When creating site areas, content items and categories, we can specify the document ID of the parent item to save the new item under. Specify this ID in the pid parameter:

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID"]

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_SiteArea" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID"]

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Category" pid="com.ibm.workplace.wcm.api.WCM_Taxonomy/ID"]

When creating content items or site areas we can specify the position of the new site area using a position parameter. We can specify to save the new item at the start or end relative to any existing site areas:

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" position="start" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID1"]

  • [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_SiteArea" position="end" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID1"]

delete

This is used to delete an item. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="delete" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

edit

This is used to open an item form in edit mode. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

read

This is used to open an item form in read-only mode. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="read" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

openmainview

This is used to open a view within an authoring portlet. The following parameters are used with this parameter to open different views of the library explorer.

To open an "All Items" view, specify the filter to use when opening the "All Items" view. For example, to open the "Content by Title" view in "All Items".

  • [plugin:RemoteAction action="openmainview" view="contentbytitle"]

The following view parameters open the all items view with a type filter applied:

  • contentbytitle
  • portalpagesbytitle
  • siteareasbytitle
  • componentsbytype
  • categoriesbytitle
  • authoringtemplates
  • presentationtemplates
  • workflows
  • workflowactions
  • workflowstages

The following view parameters open the all items view with a workflow filter applied:

  • mydraft
  • mypublishpend
  • mypublished
  • myexpirepend
  • myexpired
  • alldraftitems
  • allpublishpend
  • allpublisheditems
  • allexpirepend
  • allexpireditems

The following view parameters are used to open personal views:

  • mydeleted
  • mypendingapproval
  • myrecent
  • favorites

This view parameter opens the all deleted items view:

  • alldeleteditems

This view parameter opens the external links view:

  • externallinks

The following view parameters open a projects view:

  • allprojects
  • activeproject
  • syndicatingproject
  • pendingproject
  • publishingproject
  • publishedproject
  • publishfailedproject
  • reviewingproject

This view parameter opens the library explorer:

  • explorer

This view parameter opens the home page or launch page:

  • launchpage

To open the library explorer at the root view we add root="true" to the tag:

  • [plugin:RemoteAction action="openmainview" root="true"]

We can also specify the library to open either by including the library name or id:

  • [plugin:RemoteAction action="openmainview" libraryName="name"]

  • [plugin:RemoteAction action="openmainview" libraryId="id"]

To open one of item type views we add pfolder="name" to the tag. You must also specify a library name or ID. For example, to open the content view:

  • [plugin:RemoteAction action="openmainview" libraryName="name" pfolder="content"]

Accepted values for the pfolder parameter are:

  • content

  • categories

  • authoringtemplates

  • presentationtemplates

  • workflowitems

To open one of item type sub-views we add psfolder="name" to the tag. For example, to open the workflow view:

  • [plugin:RemoteAction action="openmainview" libraryName="name" pfolder="workflowitems" psfolder="workflows"]

Accepted values for the psfolder parameter are:

  • workflows

  • workflowstages

  • workflowactions

We can also open the library explorer at a specific item by adding an itemId parameter and specifying the UUID of the item:

  • [plugin:RemoteAction action="openmainview" itemId="UUID" ]

move

This is used to move a site area or content item. For example, to open the move dialog for a content item or site area:

  • [plugin:RemoteAction action="move" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

A move direction is specified as "1" for up and "-1" for down. For example, to move a content item up one position:

  • [plugin:RemoteAction action="move" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID1" moveDirection="1"]

link

This will link a content item to a site area. For example:

  • [plugin:RemoteAction action="link" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID2"]

When linking items we can specify the path to the parent item using the ppath parameter instead of the pid parameter:

  • [plugin:RemoteAction action="link" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" ppath="library1/sitearea1/sitearea2"]

When linking items we can create a new parent item by using the autoCreateParent parameter. You must also specify the library where the item being linked is located using the slibrary parameter. The ppath parameter is used to specify the existing parent that the new parent item is created under:

  • [plugin:RemoteAction action="link" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" autoCreateParent="true" slibrary="libraryname" ppath="library1/sitearea1/sitearea2"]

copy

This is used to make a copy of an item. For example, to copy a content item to a new site area:

  • [plugin:RemoteAction action="copy" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID2"]

We can use the following additional parameters when copying:

  • copyAsDraft="true"

    This will restart the workflow of the copy being creating. In most cases this would result in the copy being created with a status of draft.

  • wid="com.ibm.workplace.wcm.api.WCM_Workflow/ID1"

    Use this to specify a different workflow to use when creating the copy. This will also restart the workflow of the copy being creating. In most cases this would result in the copy being created with a status of draft.

  • position="start"

    This creates the copy as the first item under the specified parent item. If not specified the item will be copied as the last child of the specified parent item.

When copying items we can specify the path to the parent item using the ppath parameter instead of the pid parameter:

  • [plugin:RemoteAction action="copy" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" ppath="library1/sitearea1/sitearea2"]

When copying items we can create a new parent item by using the autoCreateParent parameter. You must also specify the library where the item being copied is located using the slibrary parameter. The ppath parameter is used to specify the existing parent that the new parent item is created under:

  • [plugin:RemoteAction action="copy" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" autoCreateParent="true" slibrary="libraryname" ppath="library1/sitearea1/sitearea2"]

approve

This is used to approve an item in a workflow. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="approve" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

decline

This is used to decline an item in a workflow. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="decline" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

saveandapprove

This is used to approve an item in a workflow where that item is currently open in edit mode within the same session. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="saveandapprove" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

  • [plugin:RemoteAction action="saveandapprove" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" isdraft="true"]

previousstage

This is used to move an item to the previous stage in a workflow. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="previousstage" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

viewversions

This is used to open the versions dialog for an item. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="viewversions" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]

viewhistory

This is used to open the history dialog for an item. You must also specify the docid of the item. For example:

  • [plugin:RemoteAction action="viewhistory" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]


Populating fields when creating or editing content items and site areas

When using the "new" or "edit" parameters with content items and site areas, we can also add data to different fields in the item using a URL. For example, to add "newcontent" as the name of the content item, we would use this URL:

The following parameters can be used to populate fields when creating or editing content items and site areas:

For example, when populating content item fields with user ids use this format:

For example, when populating content item workflow and category fields use the document IDs as their values:

For example, when populating content item date fields, the date format must be US English. Either a date and time, or just a date can be specified. If only a date is specified, the time used will be 12:00:00 AM. For example:

The date and time set here are based on the server's timezone, not the timezone of the user's computer. For example, when populating a content item JSP element, specify the path to the JSP file:

For example, when populating a content item component reference element, we specify the component to reference. For example:

For example, when populating a content item option selection element, we specify each selection option. For example:

For example, when populating a content item user selection element, we specify each user. For example:

For example, when populating a content item link element, we can specify the following parameters:

Add a link to a content item:

[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.elementname.type="content" wcmfield.element.elementname.id="contentID"]

Add a link to a link component:

[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.elementname.type="link" wcmfield.element.elementname.id="linkcomponentID"]

Add a link to an image or file resource component:

[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.elementname.type="resource" wcmfield.element.elementname.id="componentID"]

Add a link to a URL:

[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.elementname.type="external" wcmfield.element.elementname.externalReference="myurl"]

To specify whether to use the name of the item we are linking to as the link text, add this to the tag:

wcmfield.element.elementname.useReferenceLinkText="true"

When specifying an image to display as the link, add this to the tag:

wcmfield.element.elementname.linkImage="imagecomponentID"

When specifying the text of the link, add this to the URL:

wcmfield.element.elementname.linkText="text"

When specifying the description of the link, add this to the URL:

wcmfield.element.elementname.linkDescription="text"

When specifying a link target, add this to the URL:

wcmfield.element.elementname.linkTarget=

  • _blank

  • _parent

  • _self

  • _top

  • targetname


Save parameters

We can add the following "save" parameters to a remote action tag.

autoSave

Save a controllable. This happens in the background and is not displayed to users. For example:

  • wcmfield.autosave="true"

saveValidate

This parameter determines if warning and error messages resulting from the autosave will be displayed to the user. If set to "true", warning and error messages will be displayed to the user. If false, messages are suppressed. The default is true. For example:

  • wcmfield.saveValidate="false"


Add comments to the item history

When creating items that use a workflow with "Enter comment on approval" set to true, we can add a comment to the item history by adding comment="comment text" to the URL. For example:

[plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" 
createDraft="true" comment="comment text"]


Examples

Open the versions view for an item:

Open the history view for an item:

Open a content item in read mode:

Open a content item in edit mode:

Move a content item up:

Move a site area down:

Create a new content item with title of 'newcontent':

To open a content item in edit mode and automatically change keywords:

To edit a content item, automatically change the keywords and use autosave to automatically save the content (no dialog opens):

To edit a content item, automatically save the item and prevent any validation exception from being displayed, use autosave with saveValidate=false:

To create a content item, set the name and use autosave to automatically save the content (no dialog opens). The authoring template used by the content item must have a workflow pre-selected:

To edit a content item and create a draft on the edit and set the history log comment:


Parent: Developing

Related:

Custom authoring interfaces

Create a custom launch page