I have a Hyperlink column in my list which I want to apply some custom formatting. the column is not Required, meaning the field might be blank on some rows.

How can I check if the field is blank, and thereby skip the whole rendering in the JSON formatting?


The hyperlink field object has the following property which is the Display Text of hyperlink field (with example value):

    "desc": "SharePoint Patterns and Practices",

To reference the URL value, you need to use @currentField.

For Your case you can use the following JSON to format your hyperlink column:

    "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
    "elmType": "a",
    "txtContent": "@currentField.desc",
    "attributes": {
         "target": "=if(@currentField!='','_blank','_self')",
         "href": "=if(@currentField!='',@currentField, '')"
    "style": {
         "display": "=if(@currentField!='', 'block','none !important')"
| improve this answer | |
  • Thank you for your feedback. But I would like to skip the whole rendering. Your example still renders an a tag with a link. How can I tell the script to do NOTHING if the current field is blank or empty? – Frank-Ove Kristiansen Nov 27 '18 at 12:57
  • Check the updated answer. In order to do that you need to add Style property to your json to hide the blank links. – Ganesh Sanap Nov 27 '18 at 13:37
  • Welcome. please accept and upvote the answer if it helped you. – Ganesh Sanap Nov 28 '18 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.