Sharepoint MSList JSON

Mills, Alan 20 Reputation points
2024-05-24T16:38:32.6133333+00:00

I use Sharepoint MS list and have a Formula in the Validation Setting : =IF(Progress="Completed",IF(ISBLANK(Resolution),FALSE,TRUE),TRUE) with a user message as : RESOLUTION IS MANDATORY WHEN PROGRESS IS SET TO COMPLETED

It works great with a suingle line of text but users have aked for mutiple line of text and now it does not wiork. I read that it will not work with multiple lines of text but need JSON. How can I use JSON to make this work with Mutilple lines of text

User's image

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,071 questions
0 comments No comments
{count} votes

Accepted answer
  1. AllenXu-MSFT 17,576 Reputation points Microsoft Vendor
    2024-05-27T06:41:09.2566667+00:00

    Hi @Mills, Alan,

    Yes, Mutiple line of text column is not supported in list validation formula. As per my knowledge, it also doesn't work even applying JSON formatting. For example, in this thread: SharePoint Online - Multiline Text column not appearing for List validation, users still can save invalid items (in your scenario, RESOLUTION is blank when PROGRESS Is set to completed). It just used "Required Info" to highlight the blank filed but the invalid item is still saved. Essentially, this cannot be used as an alternative to list validation, because items that violate the list validation formula cannot be saved to the list at all.

    If you can accept this alternative, you can apply below JSON formatting code to the Resolution column.

    {
       "$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
       "elmType": "div",
       "txtContent": "=if([$Progress] == 'Completed' && [$Resolution] == '', 'RESOLUTION IS MANDATORY WHEN PROGRESS IS SET TO COMPLETED', @currentField)",    
       "style": {
          "color": "=if([$Progress] == 'Completed' && [$Resolution] == '', 'red', '')"
       }
    }
    
    

    User's image


    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.


0 additional answers

Sort by: Most helpful