Using JSON to Show/Hide Modern Form Field Based on Value Selected in Lookup Column

New Contributor
I am trying to modify the new-entry form of a modern list in SharePoint Online by hiding or showing a field based on the value selected in a preceding field on the same form. Microsoft offers straightforward guidance on how to do this using a JSON snippet.

While the article doesn't list a lookup column as an unsupported field type to use for this purpose, it doesn't provide guidance on how to use one in this way, either. From my testing, you can't simply grab the value of a lookup field in the described way:



=if([$LookupField]=='Hourly', 'true', 'false')



If I use a choice field instead of a lookup field, this works fine. But since I've got a lookup field, I did some more digging, and in some other contexts it looks like the value may be captured in a lookupValue property, so I tried it this way:



=if([$LookupField.lookupValue]=='Hourly', 'true', 'false')



But it doesn't work. Elsewhere someone said that by doing some debugging, it looks like the function is expecting this construction:



=if([$LookupField]=='1;#Hourly', 'true', 'false')



No errors, but still no luck. Does anyone know if it is possible to use the value from a lookup field in this way? And how would I do this?

12 Replies
best response confirmed by Aylarja (New Contributor)


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! :smile: 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 a UserVoice request for it

@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.

Thank you, @ganeshsanap , for correcting the UserVoice link. I have since edited my comment to correct the bad link.


I see that you updated the Microsoft article on this matter to include Lookup fields as not supporting the described behavior. You might be interested that there is a user comment 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.

@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.


If Lookup column is required, then condition doesn't work. Is there any way to manage that condition and required both should work?


@Avi65 Are you trying to apply conditional formula on (lookup) column which is set as required field from column settings?


As per my understanding, you cannot apply conditional formula on required columns in SharePoint list. This is a limitation of conditional formulas in SharePoint.

Please consider giving Like if my post helped you in any way. For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs


Thanks for reply and clarification.

Is there any way to display some kind of alert if some fields are not filled, once user click on Save button using json on form level??

@Avi65 Unfortunately, not possible using SharePoint JSON formatting.


You have to customize the list form using Power Apps for such requirements. Check: Customize a Microsoft Lists or SharePoint form by using Power Apps - easy & quicker solution


You can also build your own custom form using SPFx Form customizer. Check: Build your first Form customizer extension 

Please consider giving a Like if my post helped you in any way. For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs

@hanks for clarification again.


I visited your blog see following header, The yellow highlighted text in top bar, Is there any way to yellow highlighted text. I know it is title of Hub Site, is there any way to change with different text, so it should display for all the site collection. Secondly if see red box below and other navigation, in my case it is showing under images, not in same line, how can I also make it in one line.







@Avi65 Can you please start a new discussion for this? OP of this discussion & others who replied here should not get spammed because of our conversations on this thread. Thanks for understanding!

Please consider giving a Like if my post helped you in any way. For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs