Using remote actions
Use remote actions to trigger actions in HCL Web Content Manager (WCM).
Plug-in tags
You can reference remote actions in plug-in tags with the following syntax:
[plugin:RemoteAction action=" " docid=" "
dialog=" " dialogSize=" " dialogTitle=" " useCurrentContext=" " showInfoMsg=" " ]
action: Specifies the remote action to perform.docid: Specifies the document ID of the target item.useCurrentContext: Set totrueto obtain the document ID from the rendering context instead of thedocidattribute.dialog: Set totrueto render the remote action as a URL that redirects the user to a hidden portal page used for inline editing in the Web Content Viewer portlet. When set to true, configure the following nested dialog parameters:dialogSize: Defines the width and height of the dialog executing the remote action in the formatwidth,height. For example,dialogSize="200,300"sets a width of 200 pixels and a height of 300 pixels. If omitted, the dialog calculates its dimensions from the displayed content.dialogTitle: Sets the title of the dialog executing the remote action. If omitted, the dialog uses the action name.showInfoMsg: Set totrueto display success and informational messages after the remote action completes. If omitted, defaults tofalseand displays only warning and error messages.
Portlet URLs
You can append remote actions to the URL of an authoring portlet:
http://[host]/wps/myportal/wcmAuthoring?wcmAuthoringAction=action
To support inline editing of content items, append remote actions to the URL of a local Web Content Viewer portlet.
Custom authoring interfaces
Remote actions do not support building custom authoring interfaces. Remote actions deliver limited functionality and support only plain text without markup in HTML elements. Use the WCM API to build custom authoring interfaces.
Note
A DocumentId identifies each web content item. Retrieve the docid value using the DocumentID.getID() web content API method. A document ID consists of a document type and a unique ID. Document IDs in the examples, such as com.ibm.workplace.wcm.api.WCM_Content/ID1, are placeholders for real IDs.
Remote action types
-
new: Opens a new item form.[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" ]Use the following parameters with this action:
-
type: Specifies the item type to create. Supported values include:com.ibm.workplace.wcm.api.WCM_AuthoringTemplatecom.ibm.workplace.wcm.api.WCM_Categorycom.ibm.workplace.wcm.api.WCM_Contentcom.ibm.workplace.wcm.api.WCM_DateComponentcom.ibm.workplace.wcm.api.WCM_FileComponentcom.ibm.workplace.wcm.api.WCM_HTMLComponentcom.ibm.workplace.wcm.api.WCM_ImageComponentcom.ibm.workplace.wcm.api.WCM_NumericComponentcom.ibm.workplace.wcm.api.WCM_PresentationTemplatecom.ibm.workplace.wcm.api.WCM_RichTextComponentcom.ibm.workplace.wcm.api.WCM_ShortTextComponentcom.ibm.workplace.wcm.api.WCM_SiteAreacom.ibm.workplace.wcm.api.WCM_Taxonomycom.ibm.workplace.wcm.api.WCM_TextComponentcom.ibm.workplace.wcm.api.WCM_Workflowcom.ibm.workplace.wcm.api.WCM_WorkflowStage
-
atid: Supplies the document ID of the authoring template to use as the default template when creating a content item.[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" atid="com.ibm.workplace.wcm.api.WCM_AuthoringTemplate/ID1"] -
pid: Specifies the document ID of the parent item when creating site areas, content items, or categories.[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"] -
position: Positions a new site area relative to existing site areas. Set tostartto place the item at the beginning, orendto place it at the end. If omitted, the parameter defaults tostart.[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" position="start"] [plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_SiteArea" position="end"]
-
-
delete: Deletes the item specified bydocid.[plugin:RemoteAction action="delete" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] -
edit: Opens the item specified bydocidin edit mode.[plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] -
read: Opens the item specified bydocidin read-only mode.[plugin:RemoteAction action="read" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] -
openmainview: Opens a view within an authoring portlet specified byview.[plugin:RemoteAction action="openmainview" view="contentbysitearea"]The
viewparameter supports the following values:contentbysiteareacontentbytitlemyrecentmydraftmypendingapprovalmypublishedmyexpiredmydeletedalldraftitemsallexpireditemsallpublisheditemsalldeleteditemscomponentsbytype
-
move: Moves the site area or content item specified bydocidinto the parent item specified bypid. Specifying onlydocidopens the move dialog in the user interface.[plugin:RemoteAction action="move" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]-
moveDirection: Moves a content item up or down one position within the parent specified bypid. Set to1to move the item up or-1to move the item down.[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: Links the content item specified bydocidto the parent site area specified bypid.[plugin:RemoteAction action="link" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID2"]-
ppath: Specifies the path to the parent item instead of usingpidto maintain references across environments with differing document IDs or to specify a path hierarchy for automatic creation.[plugin:RemoteAction action="link" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" ppath="library1/sitearea1/sitearea2"] -
autoCreateParent: Set totrueto create a parent item automatically. When using this parameter, identify the target parent inppathand specify the source item library inslibrary.[plugin:RemoteAction action="link" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" autoCreateParent="true" slibrary="libraryname" ppath="library1/sitearea1/sitearea2"] -
slibrary: Specifies the library that contains the source item. Use this parameter withautoCreateParent.
-
-
copy: Creates a copy of the item specified bydocidin the parent item specified bypid.[plugin:RemoteAction action="copy" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID2"]Use the following parameters with this action:
-
ppath: Specifies the path to the parent item instead of usingpidto maintain references across environments with differing document IDs or to specify a path hierarchy for automatic creation.[plugin:RemoteAction action="copy" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" ppath="library1/sitearea1/sitearea2"] -
autoCreateParent: Set totrueto create a new parent item automatically. When using this parameter, specify the existing parent to create the new parent item under inppath, and specify the library that contains the item you are copying inslibrary.[plugin:RemoteAction action="copy" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" autoCreateParent="true" slibrary="libraryname" ppath="library1/sitearea1/sitearea2"] -
slibrary: Specifies the library that contains the item you are copying. Use this parameter withautoCreateParent. copyAsDraft: Set totrueto restart the workflow on the copy, which defaults the status to draft.-
wid: Specifies the document ID of the workflow to assign to the copy. Assigning a workflow restarts the workflow and sets the item status to draft.[plugin:RemoteAction action="copy" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID2" wid="com.ibm.workplace.wcm.api.WCM_Workflow/ID1"] -
position: Set tostartto place the copy as the first child item under the specified parent. If omitted, the parameter defaults to the last child.
-
-
approve: Approves the item specified bydocidin a workflow.[plugin:RemoteAction action="approve" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] -
decline: Declines the item specified bydocidin a workflow.[plugin:RemoteAction action="decline" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] -
saveandapprove: Approves the item specified bydocidin a workflow when the item is open in edit mode within the same session.[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: Moves the item specified bydocidto the previous stage in a workflow.[plugin:RemoteAction action="previousstage" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] -
viewversions: Opens the versions dialog for the item specified bydocid.[plugin:RemoteAction action="viewversions" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] -
viewhistory: Opens the history dialog for the item specified bydocid.[plugin:RemoteAction action="viewhistory" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"]
Populating fields when creating or editing content
When you use the new or edit action with content items, you can add data to fields in the content item by using parameters in the tag or URL.
You can use the following parameters to populate fields when you create or edit content:
wcmfield.content.name=wcmfield.content.title=wcmfield.content.description=wcmfield.content.authors=wcmfield.content.owners=wcmfield.content.publishDate=wcmfield.content.expiryDate=wcmfield.content.generalDateOne=wcmfield.content.generalDateTwo=wcmfield.content.workflow=wcmfield.content.categories=wcmfield.content.keywords=wcmfield.element.elementname=
Note
- Use
wcmfield.content.workflow=only when creating content. - Replace
elementnamewith the name of the element you are populating. The element parameter can only be used with the following element types: text, HTML, Rich Text, Option Selection, User Selection, Date and Time, Number, JSP, Link, and Component Reference.
Populating user fields
When you populate fields with user IDs, use the following format:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.content.authors="uid=usera,cn=cn-name,dc=dc-name"]
Populating workflow and category fields
When you populate workflow and category fields, use the document IDs as the values:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.content.workflow="ID1"]
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.content.categories="ID1"]
Populating date fields
When you populate date fields, use the US English date format. You can specify a date and time, or only a date. If you specify only a date, the time defaults to 12:00:00 AM.
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.content.generalDateOne="Feb 14, 2008 12:53:03 PM"]
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.content.generalDateOne="Feb 14, 2008"]
The date and time use the server time zone, not the time zone of the user's computer.
Populating JSP elements
When you populate a JSP element, specify the path to the JSP file:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.jspelementname="/wps/wcm/jsp/html/example.jsp"]
Populating component reference elements
When you populate a component reference element, specify the component to reference:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.mycompref.type="com.aptrix.pluto.cmpnt.NavigatorCmpnt" wcmfield.element.mycompref.id="e4bdf10042d0769698ccbeb0e25cc973"]
Populating option selection elements
When you populate an option selection element, specify each selection option:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.elementname="AA" wcmfield.element.elementname="BB"]
Populating user selection elements
When you populate a user selection element, specify each user:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.element.elementname="uid=wpsadmin,o=defaultWimFileBasedRealm" wcmfield.element.elementname="uid=wpsadmin2,o=defaultWimFileBasedRealm"]
Populating link elements
When you populate a link element, you can use the following parameters:
wcmfield.element.elementname.type: Specifies the type of item to link to. Supported values arecontent,link,resource, andexternal.wcmfield.element.elementname.id: Specifies the ID of the item to link to.wcmfield.element.elementname.externalReference: Specifies the URL to link to whentypeisexternal.wcmfield.element.elementname.useReferenceLinkText: Set totrueto use the name of the linked item as the link text.wcmfield.element.elementname.linkImage: Specifies the ID of the image component to display as the link.wcmfield.element.elementname.linkText: Specifies the text of the link.wcmfield.element.elementname.linkDescription: Specifies the description of the link.wcmfield.element.elementname.linkTarget: Specifies the target of the link. Supported values include_blank,_parent,_self,_top, andtargetname.
The following examples show how to link to each type of item:
- 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"]
-
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"] -
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"] -
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"]
Saving content
You can add the following save parameters to a remote action tag:
-
wcmfield.autosave: Set totrueto save the item in the background without displaying it to users.wcmfield.autosave="true" -
wcmfield.saveValidate: Set totrueto display warning and error messages that result from the autosave. Set tofalseto suppress the messages. If omitted this parameter defaults totrue.wcmfield.saveValidate="false"
Adding comments to the item history
When creating items that use a workflow with "Enter comment on approval" set to true, you can add a comment to the item history by adding comment="comment text" to the tag or URL. For example:
[plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" createDraft="true" comment="comment text"]
Examples
Each example shows the remote action as a plug-in tag and as a URL.
Opening item views
To open the versions view for an item:
- Tag:
[plugin:RemoteAction action="viewversions" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=viewversions&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1
To open the history view for an item:
- Tag:
[plugin:RemoteAction action="viewhistory" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=viewhistory&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1
To open a content item in read mode:
- Tag:
[plugin:RemoteAction action="read" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=read&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1
To open a content item in edit mode:
- Tag:
[plugin:RemoteAction action="edit" &docid=com.ibm.workplace.wcm.api.WCM_Content/ID1] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=edit&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1
Moving items
To move a content item up:
- Tag:
[plugin:RemoteAction action="move" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" moveDirection="1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID1"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=move&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1&moveDirection=1&pid=com.ibm.workplace.wcm.api.WCM_SiteArea/ID1
To move a site area down:
- Tag:
[plugin:RemoteAction action="move" docid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID1" "moveDirection="-1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID1"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=move&docid=com.ibm.workplace.wcm.api.WCM_SiteArea/ID1&moveDirection=-1&pid=com.ibm.workplace.wcm.api.WCM_SiteArea/ID1
Creating items
To create a content item with the title newcontent:
- Tag:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" wcmfield.content.title="newcontent"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=new&type=com.ibm.workplace.wcm.api.WCM_Content&wcmfield.content.title=newcontent
To create a content item, set the name, and use autosave to save the content (no dialog opens):
Note
The authoring template that the content item uses must have a workflow preselected.
- Tag:
[plugin:RemoteAction action="new" type="com.ibm.workplace.wcm.api.WCM_Content" atid="com.ibm.workplace.wcm.api.WCM_AuthoringTemplate/ID1" pid="com.ibm.workplace.wcm.api.WCM_SiteArea/ID2" wcmfield.content.name="newcontent" wcmfield.autosave="true" wcmfield.saveValidate="true"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=new&type=com.ibm.workplace.wcm.api.WCM_Content&atid=com.ibm.workplace.wcm.api.WCM_AuthoringTemplate/ID1&pid=com.ibm.workplace.wcm.api.WCM_SiteArea/ID2&wcmfield.content.name=newcontent&wcmfield.autosave=true&wcmfield.saveValidate=true
Editing items
To open a content item in edit mode and change the keywords automatically:
- Tag:
[plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" wcmfield.content.keywords="keyword1" wcmfield.content.keywords="keyword2"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=edit&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1&wcmfield.content.keywords=keyword1&wcmfield.content.keywords=keyword2
To edit a content item, change the keywords, and use autosave to save the content (no dialog opens):
- Tag:
[plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" wcmfield.content.keywords="keyword1" wcmfield.content.keywords="keyword2" wcmfield.autosave="true"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=edit&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1&wcmfield.content.keywords=keyword1&wcmfield.content.keywords=keyword2&wcmfield.autosave=true
To edit a content item, save it automatically, and suppress validation messages:
- Tag:
[plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" wcmfield.content.keywords="keyword1" wcmfield.autosave="true" wcmfield.saveValidate="false"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=edit&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1&wcmfield.content.keywords=keyword1&wcmfield.autosave=true&wcmfield.saveValidate=false
To edit a content item, create a draft, and set the history log comment:
- Tag:
[plugin:RemoteAction action="edit" docid="com.ibm.workplace.wcm.api.WCM_Content/ID1" createDraft="true" comment="comment"] - URL:
http://<host>/wps/myportal/wcmAuthoring?wcmAuthoringAction=edit&docid=com.ibm.workplace.wcm.api.WCM_Content/ID1&createDraft=true&comment=comment