I am attempting to hide an table “edit” button based on a field in the table that connected to the logged in user. However, when I attempt to use a display rule, there is no option to available to choose for when X is connected to Logged In User Field.
Display rules seem to work based on fields that are in the tadabase table and in the display table. You can include the connection field you your users table in the display table ( and hide it with CSS).
Table rules can then run on this connection field and hide the update/edit button.
Of course someone could easily {display} the connection field, but that might not be a problem.
I have used this in my app. I know that the actual edit/update page is accessible to specific users anyway, so all I am in danger of exposing is the link.
Although my needs were not quite aligned with your examples (due to my initial post not being clearly written), @kruizf201 helped out with some great JS scripting.
TB.render(‘component_94’, function(data) {
var userAssociatedLocations = "{loggedInUser.Associated Locations}";
var incidentAffectedLocations = Object.values(data.record.field_62);
var userContainsAffectedLocations = incidentAffectedLocations.some(function(value) {
return userAssociatedLocations.includes(value);
});
if (userContainsAffectedLocations) {
console.log("The User Contains Affected Locations");
setInterval(function(){
$(".user-based-view").show();
});
} else {
console.log("The User Does Not Contains Affected Locations");
setInterval(function(){
$(".user-based-view").hide();
});
}
});
Details for anyone that is looking to adapt to your application:
component_94 is the component where the “Associated Locations” field is located on the page.
field_62 is the field slug for the Associated Locations in the Users table
user-based-view is the CSS class to hide the column in the desired table