This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



May 11, 2011, 1:54 PM
51 Posts
topic has been resolvedResolved

column link in a view only when member of role

  • Category: Other
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 3
I have a column in a view.
I would like the items in this column to be a link only if the user is member of a role. 
When the user isn't a member he should still see the values of this column, but not as links. 
Almost everything is computable in Xpages , but I don't see how to do this. 
Any idea ? 
May 11, 2011, 3:49 PM
3 Posts
Re: column link in a view only when member of role
I think you can go to the All Properties panel on the view column, go to Basics > displayAs and click the diamond and add your code to check for membership in a role and depending on the results return "link" or "text"
 
I've done something similar with whether or not to show checkboxes for a column, based on a user's role
May 12, 2011, 11:29 AM
51 Posts
Re: column link in a view only when member of role
 There's something wrong with my code :
 
var v:Array = database.queryAccessRoles(session.getEffectiveUserName());
if (@IsMember("[role1]", v)){
    return link;
}else{
    return text;
}
 
 
May 12, 2011, 12:01 PM
261 Posts
Re: column link in a view only when member of role
You should probably return a string:
 
return "link"
or
return "text"
 
 
By the way, instead of using the queryAccessRoles function, you can also use
 
var roles = context.getUser().getRoles();
 
A one-line version of your statement could then be:


return ( context.getUser().getRoles().contains( "[role1]" ) ? "link" : "text");

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal