12-28-2020 07:34 AM
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?
12-28-2020 03:06 PM
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.
Manager can see all the sample docs in the system:
While AP Users Group (using Security Keyword of Approver = <<username>>) and our custom date range sees only:
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.
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
12-28-2020 03:06 PM
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.
Manager can see all the sample docs in the system:
While AP Users Group (using Security Keyword of Approver = <<username>>) and our custom date range sees only:
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.
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
12-28-2020 04:36 PM
This is a really cool idea Eric. The only question I have is does the usage of an e-form require any additional licensing?
Thanks.
12-28-2020 05:04 PM
No eform license required in this case. The Form in this custom query configuration is just used as the User Interface. To test this out I completely unlicensed all my demo system form licenses and after a complete restart of my IIS the UI in the CQ still works in my unity client.
The Eforms liscense is needed if one needs to be able to directly or indirectly (workflow) create forms as Documents stored in the system (using up Database and Diskgroup resources).
12-28-2020 08:34 PM
Very good to know. Thank you sir!
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.