This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Modifying search on event

handpuppet - Friday, July 17, 2015 8:09 AM:

Hello,

I have an ItemType called Documents that I would like to have catch the search in the event OnBeforeGet() that checks the identity of a user and if the identity of the user is one thing, it modifies the search criteria so that only two columns are searched, and I would specify the values for those two columns.  I already have the code to check for the identity group the user is in.  What I am struggling to find is how to modify the search criteria in the server side C# method OnBeforeGet(). 

 

Any help would be greatly appreciated.



arnaud.chaussard - Friday, July 17, 2015 9:46 AM:

Hello !

You will have to use this.removeProperty(propertyName) and this.setProperty(propertyName, propertyValue) to change the request before it is sent. That way you will adjust what is requested and returned by the server.

Specifically in your case you may have to remove all the properties you do not want the user to search for and to change the properties where you want to adjust the values.



handpuppet - Friday, July 17, 2015 10:08 AM:

Thank you for the suggestion.  I will try that now.  Is it at all possible to programmatically get the name of a saved search that the user is executing?



handpuppet - Friday, July 17, 2015 11:20 AM:

Do I need to get a reference to the "Documents" ItemType before I remove the property and set the property?  The search did not return any results using the remove Property line and then the setProperty line



arnaud.chaussard - Saturday, July 18, 2015 11:47 AM:

Hello !

Don't think so, can you post some code ?

Tx !