lunedì 30 luglio 2012

Oracle UCM: Performing basic tasks using HCST and IDOC scripts


In this post I will create a simple HCST page containing some IDOC scripts that allow to perform some basic actions like searching for specific content among WebCenter Content and change metadata values on link click.

If you are new to IDOC I suggest you to have a look at documentation:

Idoc Script Reference Guide

Another really precious resource for IDOC, HCST, HCSP, and UCM in general is Brian Huff's book "The Definitive Guide to Stellent Content Server Development".

We will create a HCST (Hypertext Content Server Template) page that will contain both HTML and IDOC Scripts.

The following code will perform a search of all documents in UCM with:

Security Group: Public
Document Type: Document
Custom Metadata: Pending

Likely you will change these according to your UCM configuration.

Copy/paste the following code to "test.hcst"

<html>
<head>
<title>Simple HCST Page</title>
</head>

<body>

<$QueryText="dSecurityGroup <matches> `Public` <AND> dDocType <matches> `Document` <AND> xCustom_Metadata <matches> `Pending`"$>
<$executeService("GET_SEARCH_RESULTS")$>

<table>
<tr>
<td>View Content</td><td>Content ID</td><td>Check-in Date</td><td>Custom Metadata</td><td>APPROVE</td><td>REJECT</td>
</tr>
<$loop SearchResults$>
<tr>
<td><a href="<$SearchResults.URL$>">VIEW CONTENT</a></td>
<td><$SearchResults.dDocTitle$></td>
<td><$SearchResults.dInDate$></td>
<td><$SearchResults.xStatus_Offerta$></td>
<td><a href="<$HttpCgiPath$>?IdcService=UPDATE_DOCINFO_BYFORM&coreContentOnly=1&dID=<$SearchResults.dID$>&dDocName=<$SearchResults.dDocName$>&dRevLabel=<$SearchResults.dRevLabel$>&dSecurityGroup=<$SearchResults.dSecurityGroup$>&dDocAccount=<$SearchResults.dDocAccount$>&xCustom_Metadata=Approved&IsSoap=1">CLICK HERE TO SET CUSTOM METADATA TO APPROVED</a></td>
<td><a href="<$HttpCgiPath$>?IdcService=UPDATE_DOCINFO_BYFORM&coreContentOnly=1&dID=<$SearchResults.dID$>&dDocName=<$SearchResults.dDocName$>&dRevLabel=<$SearchResults.dRevLabel$>&dSecurityGroup=<$SearchResults.dSecurityGroup$>&dDocAccount=<$SearchResults.dDocAccount$>&xCustom_Metadata=Rejected&IsSoap=1">CLICK HERE TO SET CUSTOM METADATA TO REJECTED</a></td>
</tr>
<$endloop$>
</table>

</body>
</html>


Login to UCM and check-in test.hcst file. If you will publish hcst pages in a production environment I suggest to use Web Mapped Folders in order to have a more friendly URL.

Open page in a browser and you will see something like this.

Nessun commento:

Posta un commento