Calculated column Translate into JSON Formatting

cooltechie-5986 1 Reputation point
2023-05-31T01:00:55.1433333+00:00

Hi,

I have a calculated column with the below formula. This calculated column rendered as HTML with a clickable link in SP 2013. However, in SP 2019 it doesn't work. I need to translate same to a JSON Column formatting that I can use.

How can I incorporate JSON Formatting with same logic? Any help is appreciated.

Thanks.


The calculated formula I have is:

=IF(New<>"",
   IF(CID="",
IF(New,"Uploading...",""),"<a href='#' class='cascadingLink' onclick='openInDialog(700,950,true,true,true,""/sites/TW/Reviews/Reviews/Forms/EditForm.aspx?ID="&CID&""");'>Edit Review</a>"),"")

where "New" and "CID" are the list columns.  

How can I replicate this rendering using JSON Column formatting or JSLink ? Any help with JSON column formatting code is highly appreciated.
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,211 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Emily Du-MSFT 43,831 Reputation points Microsoft Vendor
    2023-05-31T09:06:11.2833333+00:00

    Based on your description, I understand that you want to add a clickable link in a column by using JSON formatting.

    Here is an example for you:

    1.Create a text column.

    2.Use following formula in the column.

    {
       "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
       "elmType": "a",
       "txtContent": "Edit Review",
       "attributes": {
          "target": "_blank",
          "href": "='http://sp/sites/sites/TW/Reviews/Reviews/Forms/EditForm.aspx?ID='+[$CID]"
       }
    }
    

    Reference:
    https://www.sharepointdiary.com/2019/01/format-calculated-column-as-hyperlink-in-sharepoint-online.html

    https://www.c-sharpcorner.com/article/how-to-make-sharepoint-field-data-as-hyper-link-using-js-link/

    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.