SP List View formatting using JSON - Query String parameter

Regular Contributor

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 -  

https://<<tenantname>>.sharepoint.com/sites/<<SiteCollection2Name>>/SitePages/IntranetHome.aspx?Quer...

 

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

4 Replies
You can see in the PnP GitHub if there is anything that could match your use case.
https://github.com/pnp/List-Formatting/tree/master/column-samples

@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'"

 

DocumentationJSON Formatting syntax reference 


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.

Hi @ganeshsanap, My page query string parameter values will change for most of the scenarios. Its not constant.

Yeah, I was not able to find the option of reading query string parameters. :(

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