As the tilte says. We want the "Classification" property of ItemType "Document" to be hidden for a user if they are part of a specific identity.
I also want the value of "Classification" to set as "General" for these users when they search of Documents. I have achieved this. However, now we do not want the users of this identity to be able to see the "Classification" column in the search grid. How do I accomplish this.
I apply the code below to "onBeforeGet".
Mentioned below is my method:
Innovator inn = this.getInnovator();
//Get ID of the logged in user
Item alias = inn.newItem("Alias","get");
alias.setProperty("source_id",inn.getUserID());
alias.setAttribute("select","related_id");
alias = alias.apply();
string relatedId = alias.getProperty("related_id");
int count = alias.getItemCount();
string target = "DBA5D86402BF43D5976854B8B48FCDD1";
if(relatedId == target){
this.setProperty("classification", "General");
this.createRelationship("Property", "edit");
this.setProperty("id", "DE3C90BC7B434151A6F3C9D97A5B2B69"); // Property ID
this.setProperty("is_hidden", "1"); // Hide the property
this.setProperty("is_hidden2", "1"); // Hide the secondary property
}
return this;