SharePoint List Header-JSON coding for IF and statement

Harry N Nomikos 1,311 Reputation points
2023-09-27T13:53:05.02+00:00

Hi Team,

I'm trying to integrate an IF(AND statement into an existing IF statement which works for my SharePoint list header.

I want it to return this value if "Is a Change Manager required?" = 'Yes' and "Assigned Change Manager" ='blank', then for it to return "Bus Metro Change Contact: Resource TBC", and if false to return "Bus Metro Change Contact: "

I'll provide the column names so there's confusion and the existing JSON coding where the IF formula is, I need to keep active.

Field Column name
Is a Change Manager required? Is_x0020_a_x0020_Change_x0020_Ma
Assigned Change Manager Assigned_x0020_Change_x0020_Mana

Existing JSON Coding under "txtContent"

                            "elmType": "span",
                            "attributes": {
                                "class": " ms-fontColor-white ms-fontWeight-bold ms-fontSize-12"
                            },
                            "txtContent": "=if([$Is_x0020_a_x0020_Change_x0020_Ma] =='No','Bus Metro Change Contact: Not Required','Bus Metro Change Contact: ')"

Look forward to your response team.
Regards,
Harry

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,345 questions
{count} votes

Accepted answer
  1. Emily Du-MSFT 46,171 Reputation points Microsoft Vendor
    2023-09-28T06:39:31.4266667+00:00

    Here are JSON codes for you:

    "elmType": "span",
    "attributes": {
         "class": "ms-fontColor-white ms-fontWeight-bold ms-fontSize-12"
    },
    "txtContent": "=if (([$Is_x0020_a_x0020_Change_x0020_Ma] == 'No')||([$Assigned_x0020_Change_x0020_Mana] != ''), 'Bus Metro Change Contact:', 'Bus Metro Change Contact:Resource TBC')"
    
    

    Result:

    enter image description here

    enter image description here


    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

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.