Nov 30 2021 01:27 AM
Hi Everyone,
We have a requirement to customize the SP list view using the JSON formatting for Gallery view. In this view we have to present a clickable control and the target link is a field in the same list.
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting
This custom JSON based list view will be added to SharePoint page using OTB list view webpart. This page will have a query string parameter associated like "QueryStringKey" and value for example "QueryStringValue"
https://<<tenantname>>.sharepoint.com/sites/<<SiteCollectionName>>/SitePages/CustomPage.aspx?QueryStringKey=QueryStringValue
SP list, Link field value in one list item - https://<<tenantname>>.sharepoint.com/sites/<<SiteCollection2Name>>/SitePages/IntranetHome.aspx
The requirement we have is to update the link field value that is rendered in gallery view of that list view as below -
So, We would like to know if we can update the value that is getting rendered in the list view using the JSON format accept the query string parameter values as said above. It would be helpful if any leads are provided for this requirement implementation without any SPFx customization/development.
Thanks & Regards,
Bhanu
Nov 30 2021 02:12 AM
Nov 30 2021 08:50 AM - edited Apr 17 2023 06:14 AM
@bhanu chintha Unfortunately, JSON formatting does not support reading URL query string parameters.
If your query string parameters are fixed then you can create a new link by using string concatenation (+ operator) in JSON formatting. Considering internal name of your column is "PageLink", you can build new URL like:
"href": "=[$PageLink] + '?QueryStringKey=QueryStringValue'"
Documentation: JSON Formatting syntax reference
Reference: How to find the Internal name of columns in SharePoint Online?
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.
For SharePoint/Power Platform blogs, visit: Ganesh Sanap Blogs
Dec 01 2021 08:58 AM
Dec 01 2021 10:43 PM
@bhanu chintha If query string parameters are not constant then it is not possible to achieve using JSON formatting.
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.