Using SPO Modern, I've hidden certain columns on a list on the newitem.aspx pg as I do not want users to be able to manipulate them. However as an admin I need to be able to access the columns; is there any way of doing so without having to edit the item in grid view? In previous version of sharepoint i'd insert some simple jquery in a CEWP webpart but that doesnt seem to be an option in SPO.
1 Answer
You can select the context menu for the column and select Edit conditional formula to enter a formula that will determine if the column should be displayed on the form.
In that formula, you can use @me
to get the email address of the current user. So you can set the conditional formula to show the column to you but not to other users. Something like this:
=if(@me == '[email protected]', 'true', 'false')
I'm not sure if there's a way to get additional information about the current user (e.g. if they are a site admin). I did some searching but I didn't find anything. Maybe someone else can provide more information on this.
-
thanks for this! Do you know if there's a way I can designate others via they email address? not just me– JeromeCommented Apr 5, 2022 at 18:28
-
1@Jerome Yes, you can nest the if statements to designate multiple users. For example,
=if(@me == '[email protected]', 'true', if(@me == '[email protected]', 'true', 'false')
Commented Apr 6, 2022 at 17:31 -
Thanks, I used the formula with my own address; the columns are hidden but it's hidden to me too, not sure why. Are there any other unique identifiers that can be used other than email? say login ID?– JeromeCommented Apr 6, 2022 at 20:43
-
@Jerome What formula did you use (you can strip out the email addresses)? Maybe it's not formatted correctly. As to the second part of your question, I'm not sure if there's a way to get additional information about the current user. I did some searching but I didn't find anything. Commented Apr 6, 2022 at 20:49
-
1The first has the correct form but the
true
andfalse
are reversed. Theif
function takes three parameters, a condition, the value to return if the condition is true, an the value to return if the condition is false. In the context of conditional formatting of columns in forms, the column will show if the formula returns true and it will not show if the formula returns false. So, if you want the column to show for[email protected]
but not for others, the formula should be=if(@me == '[email protected]', 'true', 'false')
Commented Apr 7, 2022 at 16:39