In SharePoint Online, creating form in List using Content Type, making other column invisible based on previous columns choice selection (Yes or no )

Anonymous
2024-03-18T22:00:51+00:00

how can we format first column ( say employee ) to only be visible if other column ( say internal ) choice type selection is "no" and if selection is "yes" then first column invisible.

Can we use JSON formatting in this case, since JSON formatting which I am using is not working. Its as below:

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",

"elmType": "div",

"children": [

{ "elmType": "div", "txtContent": "@employee",

"style": {

"display": "=if([$internal] == 'Yes', 'block', 'none')",

"pointer-events": "=if([$internal] == 'Yes', 'auto', 'none')",

"opacity": "=if([$internal] == 'Yes', '1', '0.5')"

}

}

]

}

Help would be greatly appreciated

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Anonymous
    2024-03-19T04:19:57+00:00

    Dear,

    Good morning!

    Thanks for posting in the Microsoft Community. We're happy to help. We're looking into your situation and will update you soon.

    Appreciate their patience and understanding and thank them for their time and cooperation.

    Sincerely

    Stacey

    0 comments No comments
  2. Anonymous
    2024-03-19T04:57:58+00:00

    Dear Kaur Albertan,

    Good day!!

    I understand your concern and to my knowledge, I would like to suggest you using the Conditional Formula on the Employee column, where it will display the Internal column in the List Form by default and show the Employee column only when internal column is set to No.

    Here is the example:

    When the Internal column is set to No:

    When the Internal Column is set to Yes:

    Conditional Formula used: =if([$Internal] == 'No', 'true', 'false')

    Here is the reference article: Show or hide columns in a list form | Microsoft Learn

    Steps:

    Open the List in SharePoint Online> Click on New Item> Edit Form (beside the Copy Link)> Edit Columns> Hover your mouse on the Employee Column and click on the three dots> Edit conditional Formula> Copy and Paste the formula> Click on Save> Click on Save in the Edit Columns in Form.

    However, if you are looking to achieve your requirement with the help of JSON code, I would like to suggest you post your concern in the related community i.e., Ask a question - Microsoft Q&A with SharePoint Development tag to get the detailed help from the experts.

    Apologies for redirecting you to different community as the members in the category posted focus on the users with the Microsoft 365 concern and have limited knowledge on the JSON code, so to get the fast and better assistance, we have redirected you in the correct path.

    Appreciate your patience and understanding, Have a great day!!

    Best Regards,

    Sophia

    0 comments No comments
  3. Anonymous
    2024-03-19T14:18:00+00:00

    Thanks Sophia !! It helps

    1. But, I was not able to view Facility Coordinator column, (other column is "Is") when I choose No on "Is" column . I used following formula.

    Image

    2)

    Just one more question, what if the column name contains more than word. For Example, column "internal" is "Is the person an internal employee?".

    How to write this in the above formula if([$Internal] == 'No', 'true', 'false').

    Thank You

    0 comments No comments
  4. Anonymous
    2024-03-20T11:39:35+00:00

    Dear Kaur Albertan,

    Thanks for writing back and updating with us. Apologies for the delay in the response.

    As per the further updates, I would like to share my knowledge on your queries:

    Query 1:

    As per the conditional formula users, theFacilities Coordinator column will only show in the New List Form when theIs column is set to No. If Is column is set to Yes, then the Facilities Coordinator columnwill be hidden.

    If you want Facilities Coordinator columnto show when the If Is column is set to Yes, please use the below formula:

    =if([$Is] == ‘Yes’, ‘true’, ‘false’)

    Query 2:

    Conditional Formula will use the internal names of the Column and when you create a column in SharePoint Online, the column will have the internal name. So, I would like to suggest you use the Internal Name of the column in the Conditional Formula.

    To get the internal of the column, please follow the steps:

    Open the List> Settings> List Settings> Scroll down to Columns and click on the Column which you want the internal name> At the end of the URL, you will find the internal name of the column:

    Conditional formula with internal name:

    Note: Any misunderstanding or confusion, we are sorry and request you to share the more details with some screenshots which will help us to better understand and guide you further.

    I hope the above explanation clear your doubts and if you feel my reply helped to explain your situation, please click on the helpful button (Yes or No) in the reply.

    This way, you bring the answer to forefront of your thread, providing better visibility and aiding other users in finding valuable guidance.

    Thanks a lot,

    Sophia

    0 comments No comments
  5. Anonymous
    2024-03-20T14:44:03+00:00

    Thanks for clarifying

    I followed same steps but it didn't quite worked the way out. I am sharing screenshots, please let me know where I am doing something wrong

    Here, is screenshot of Internal name

    So, here is the conditional formula.

    It again says invalid connection.

    Is Facility Manager making this request? - It's a choice menu with choices "Yes" or "No"

    Facilities Coordinator - It's a people choice box (like directory to our organization).

    I would really appreciate your help

    Please and Thanks

    0 comments No comments