cancel
Showing results for 
Search instead for 
Did you mean: 

A Custom Query with Pre-defined keyword values (search criteria) in a personal page?

Matti_Pellinen
Confirmed Champ
Confirmed Champ

Hi,

I'm using username as a security keyword. I want a Custom Query that retrieves all documents that the user 'owns' or has a right to see. In the Unity client I'd like to see that Custom Query in a Personal Page so that with a single click the user can retrieve all documents that belongs to him/her. Would be ideal if the hitlist can be narrowed down to 'new' documents or only to documents that have a specific 'status' keyword value. Which way I can achieve this functionality? Only through custom written SQL?

1 ACCEPTED ANSWER

Eric_Beavers
Employee
Employee

One of my favorite ways to do this is to leverage the HTML Form version of a Custom Query. This allows you to build whatever interface you want leveraging HTML code (<form>). Furthermore, you can set defaults and make them read only.

 

According to the Eforms MRG you can access username in a few properties.

 

OBProperty_CurrentUserName Displays the OnBase user name of the currently logged
in user.
OBProperty_CurrentUserRealName Displays the real name of the currently logged in user,
which is specified in the Configuration module. If no real name has been specified, this property is left
blank.
OBProperty_CurrentUserDisplayName Displays the display name of the currently logged in
user based on the global client setting in the Configuration module. If the global client setting is set
to show the user’s real name, and no real name has been configured, this property displays the OnBase
user name.

 

With a little bit of JavaScript, the username value can be copied to a keyword field.

 

Here is what a potential HTML Form based Custom Query could look like in a Unity Client.

fe544c20d76741c6b8251b42fe13e9fc

 

 

Manager can see all the sample docs in the system:

b913944234b644c29b20a4c7209feb26

 

While AP Users Group (using Security Keyword of Approver = <<username>>)  and our custom date range sees only:

299aa9b9ac77445eb3819c1a85d5b1f1

Using the Shortcut at the top, I added the result set to my personal page. With further testing, Importing a new document that is indexed to this user shows in the personal page tile too.

db3d15a2a51e4c5b967034dde4483b14

7990a5d825c94920b4c1e1ea2c43263a

 

What about the form User Interface?

The HTML form code for your requirements might look like the following.

Disclaimer: This code is provided as an educational example - it is provided “AS IS.” Hyland makes no warranties or representations regarding this post and does not provide any maintenance and support for it.

Note that in this version the Dates are hard coded to the year of 2020:

 

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">    <meta content="utf-8" http-equiv="encoding">	<title>My Document Search</title></head>	<body onload="setQueryValues()">		<!-- CQ Eform code starts here -->		<form method="POST">		<br />			<table>				<tr>					<!-- Search Field for Check Number -->					<td><label for="kwCheckNum">Check Number:</label></td>					<td><input type="text" id="kwCheckNum" name="OBKey_Check_#_1" size="20"></td>				</tr>				<tr>					<td><label for="propOnBaseUser">Current User Name:</label></td>					<td><label for="kwOnBaseUser">Approver:</label></td>					<td><label for="propFromDate">Date Range</label></td>				</tr>				<tr>					<!-- Read-Only Field with Current username -->					<td><input type="text" id="propOnBaseUser" name="OBProperty_CurrentUserName" readonly></input></td>					<!-- Read-Only Field with approver OnBase Username Keyword -->					<td><input type="text" id="kwOnBaseUser" name="OBKey_OnBase_Users_1" readonly></input></td>					<!-- Date Search Range - hard coded with VALUE argument -->					<td><input type="Date" id="propFromDate" name="OBFromDate" value="2020-01-01" size="20" readonly>					<br>To<br>					<input type="Date" id="propToDate" name="OBToDate" value="2020-12-31" size="20" readonly>					</td>				</tr>				<tr>					<td colspan="2"><input type="submit" value="Search" name="OBBtn_Yes"></td>				</tr>			</table>		</form>	<script>		}		//this sets the Approver field to the current user		function setQueryValues(){			document.getElementById("kwOnBaseUser").value = document.getElementById("propOnBaseUser").value;		}		</script>	</body></html>

 

 

 

Here is a more advanced version. I was trying to use the Custom Query Default Date Range setting in OnBase Configuration, but it was not working for me. So I added some additional JavaScript to calculate the current date, 90 days in the past, and copy those values to my form so every day the form is dynamically correct.

 

<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>    <meta content="text/html;charset=utf-8" http-equiv="Content-Type">    <meta content="utf-8" http-equiv="encoding">	<title>My Document Search</title></head>	<body onload="setQueryValues()">		<!-- CQ Eform code starts here -->		<form method="POST">		<br />			<table>				<tr>					<!-- Search Field for Check Number -->					<td><label for="kwCheckNum">Check Number:</label></td>					<td><input type="text" id="kwCheckNum" name="OBKey_Check_#_1" size="20"></td>				</tr>				<tr>					<td><label for="propOnBaseUser">Current User Name:</label></td>					<td><label for="kwOnBaseUser">Approver:</label></td>					<td><label for="propFromDate">Date Range</label></td>				</tr>				<tr>					<!-- Read-Only Field with Current username -->					<td><input type="text" id="propOnBaseUser" name="OBProperty_CurrentUserName" readonly></input></td>					<!-- Read-Only Field with approver OnBase Username Keyword -->					<td><input type="text" id="kwOnBaseUser" name="OBKey_OnBase_Users_1" readonly></input></td>					<!-- Date Search Range - filled by Javascript Functions -->					<td><input type="Date" id="propFromDate" name="OBFromDate" size="20" readonly>					<br>To<br>					<input type="Date" id="propToDate" name="OBToDate" size="20" readonly>					</td>				</tr>				<tr>					<td colspan="2"><input type="submit" value="Search" name="OBBtn_Yes"></td>				</tr>			</table>		</form>	<script>		//this function allows dates to be incremented or decremented by a number of days		function addDays(date, days) {			  var result = new Date(date);			  result.setDate(result.getDate() + days);			  return result;		}		//in order to set the date range above the format has to be YYYY-MM-dd		//tested with Chrome and firefox - might not work for IE		function getFormattedDate(date) {		  var year = date.getFullYear();		  var month = (1 + date.getMonth()).toString();		  month = month.length > 1 ? month : '0' + month;		  var day = date.getDate().toString();		  day = day.length > 1 ? day : '0' + day;		  //return month + '/' + day + '/' + year;		  return year + '-' + month + '-' + day;		}		//this function gets the current date and 90 days in the past		//it also calls the addDays() and getFormattedDate() functions created earlier		//next it updates the read only date search fields on the form		//then it sets the Approver field to the current user		function setQueryValues(){			var dateToday = new Date();			var date90DaysAgo = addDays(dateToday,-90);			//alert("Today is "+ getFormattedDate(dateToday) +" and 90 days ago was "+ getFormattedDate(date90DaysAgo));			document.getElementById("propToDate").value = getFormattedDate(dateToday);			document.getElementById("propFromDate").value = getFormattedDate(date90DaysAgo);			document.getElementById("kwOnBaseUser").value = document.getElementById("propOnBaseUser").value;		}		</script>	</body></html>

 

Here is another post with an example of this technique of using HTML Forms for custom queries:

 

https://community.hyland.com/forum/threads/76241-security-keyword-alternatives

 

View answer in original post

6 REPLIES 6

I'll test this answer later, but I have another question also related to the username, merely how to apply it to the form without the user seeing it.

You can hide fields on a form. To enter hidden fields on a form, use the following syntax:
<INPUT type="hidden">
Example:
<input type="hidden" name="OBKey_First_Name_3" size="40" value="Name">
This syntax will only hide the field on the form. If the field is associated with a Keyword Type,
values will still be visible in the Keyword Panel unless the Keyword Type is configured with the
HID option selected. For more information on how to configure this setting, see the System
Administration documentation in the Configuring Document Type Keywords topic.

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.