Preventing a option selection of a column unless another column has a certain value in a SharePoint

Copper Contributor

I am trying to format a SharePoint list such that users won't be able to select an option value in column unless another column is set to a certain value. 

 

For Example, Column_2 with a list of values of "Complete" & "Working", the users shouldn't be able to select "Complete" unless Column_1 value is set to "Done".

 

Thanks

1 Reply

@Saurabh022 You have a requirement to prevent users from selecting a specific option value in one column (Column_2) of a SharePoint list, unless another column (Column_1) has a certain value. For example, users should not be able to select the "Complete" option in Column_2 unless Column_1 is set to "Done".

 

To implement this conditional formatting, I will leverage the column formatting feature in SharePoint Online. First, I'll navigate to the SharePoint list where this requirement needs to be applied. Then, I'll access the column settings of Column_2 and select the "Column Formatting" option. Within the column formatting pane, I'll switch to the advanced mode and add a custom JSON code snippet. This JSON code will use an if condition to check the value of Column_1. If Column_1 is not set to "Done", it will hide the dropdown options for Column_2 and display a message indicating that the option cannot be selected unless Column_1 is set to the required value. However, if Column_1 is set to "Done", the dropdown options for Column_2 will be displayed normally, allowing users to make their selection. After adding the JSON code and replacing the column names with the appropriate internal names, I'll save the column formatting to apply the changes. It's important to note that this approach applies formatting to the column but does not prevent direct editing of values in the list. If stronger validation is required, I may need to explore alternative solutions like custom forms or event receivers.

 

Throughout this process, I'll ensure that I have the necessary permissions to modify column formatting in the SharePoint list. I'll also thoroughly test the implementation to verify that the conditional formatting is working as expected and provide any necessary guidance or training to the end-users. If you have any additional requirements or specific scenarios that need to be addressed, please let me know, and I'll be happy to refine this approach accordingly.

 

My goal is to provide a solution that meets your business needs while ensuring a seamless user experience within the SharePoint environment.