Forum Discussion
Strange behaviour of Lookup hyperlink
Hello All,
In SharePoint Online, I noticed one strange behavior of lookup column (with allow multiple choice setting enabled) . In this lookup we are allowing user to select multiple value.
Now once user selected on any item in view form and thne once he click on any lookup hyperlinlk, look up item form opens correctly but it also open choice field pulldown, which should not open. see below picture
In original form I have two three lookup field, same behavior occuring. I tested in other list as well noticed same kind of behavior, how can we avoid this ? Seems to be SharePoint issue, if we dont have solution for this kind of issue. Can we use json with each lookup and open lookup viewform in another tab instead of opening here.
Regards
Avian
- Ashish KanoongoCopper Contributor
Hello Avian,
I used following json code in lookup column formating, it is working as expected. But I am still wondering if that on viewform.aspx and if you click on lookup hyperlink, it still asking for selecting for adding or removing in viewforn, which should not correct. If you are on viewform.aspx you can view the item on click on hyperlink, you should not be allowed to select value from lookup column. Is this bug? This was working correcttly in SP2016.Anyway here is the json code, hope it will help someone.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "children": [ { "forEach": "lookupIterator in @currentField", "elmType": "a", "style": { "padding-right": "=if(loopIndex('lookupIterator') == length(@currentField) - 1, '0px', '5px'" }, "txtContent": "=if(loopIndex('lookupIterator') == length(@currentField) - 1, [$lookupIterator.lookupValue], [$lookupIterator.lookupValue] + ', ')", "attributes": { "target": "_blank", "href": "='https://tenantname.sharepoint.com/sites/TestR/Lists/Libreria/DispForm.aspx?ID=' + [$lookupIterator.lookupId]" } } ] }
- Ashish KanoongoCopper Contributor
Hello Avian,
Seems you are overlooked following option from list advanced setting, only need to change this setting
No json required until you want open lookup dispform in another tab. Finally the issue is resolved.
Hope this helps someone.
Avian