Forum Discussion
Using JSON to Show/Hide Modern Form Field Based on Value Selected in Lookup Column
- Apr 16, 2021
Lookup fields are not supported in conditional formulas in SharePoint.
Source: can we show a column in a form based on a lookup field?
Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.
ganeshsanap, thanks for responding to my question here as well as on StackExchange. Unfortunately, your answer didn't change from "no" to "yes" in between!
But everything I see confirms what you say: currently, it isn't possible to use the value of a Lookup field in this way. For anyone interested in this capability, I have created https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/43186173-enable-the-ability-to-hide-sharepoint-form-fields.
Aylarja You're welcome!
Thanks for creating a UserVoice for this. But looks like the link to UserVoice is broken/wrong in your above reply.
So, I am adding the correct link below for anyone who wants to vote on your idea (I already voted!):
Enable the ability to hide SharePoint form fields based on the value of Lookup columns
Also, I have updated the documentation at: Show or hide columns in a list or library form
Please click Like if my post was useful to you in any way.
- AylarjaApr 16, 2021Copper Contributor
Thank you, ganeshsanap , for correcting the UserVoice link. I have since edited my comment to correct the bad link.
I see that you updated https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-conditional-show-hide on this matter to include Lookup fields as not supporting the described behavior. You might be interested that there is https://github.com/SharePoint/sp-dev-docs/issues/6917 on GitHub related to that article that suggests that the Lookup field can be used in this way. In my testing, the approach suggested there did not work, but I am interested in seeing if others find the author's recommendation works.
- ganeshsanapApr 16, 2021MVP
Aylarja I did lot of other updates to the article along with adding lookup as not supported column.
Also, I tried the approach suggested by Denis to use ItemID;#ColumnValue. But it didn't work for me as well.
Even I saw the below message in browser's developer console when I tried to use the lookup column in conditional formula (Might be because there was no value on list form for the lookup column):
Please click Like if my post was useful to you in any way.
- Avi65Apr 28, 2023Brass ContributorHello,
If Lookup column is required, then condition doesn't work. Is there any way to manage that condition and required both should work?
Avian