0

Desired Behaviour

If the value of a Managed Metadata column with internal name of Asset_x0020_Type is Laptop, show the ComputerName field in the list form, otherwise, hide it.

Actual Behaviour

The field ComputerName is hidden even though Asset_x0020_Type is Laptop.

What I've Tried

=if([$Asset_x0020_Type] == 'Laptop', 'true', 'false')

Columns of type Managed Metadata are now supported in column formatting, and I have referenced Managed Metadata columns before when column formatting, so I'm not sure why it is not working.

2 Answers 2

0

Ergh:

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-conditional-show-hide#unsupported-column-types-in-conditional-formulas

While the formula supports many of the available column types, we do not currently support the following column types:

  • Person or Group with multiple selections
  • Choice with multiple selections
  • Time calculations in Date and Time column
  • Currency columns
  • Location columns
  • Calculated columns
  • Managed Metadata columns

They seem to have a workaround for Lookup columns, but not for Managed Metadata columns:

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-conditional-show-hide#lookup-column

Even it Calculated Column was supported in conditional formulas, Calculated Column cannot reference Managed Metadata columns, so that is not a solution either.

It seems odd that all column types aren't treated equally - i.e. all users at some point are going to want to reference the values in all column types, it's frustrating when you have to resort to workarounds like duplicate 'calculated' columns, and even more so when the workarounds aren't available either.

1
  • Please review my response, if it helps, remember to mark it as an answer.
    – Julie_MSFT
    Aug 3, 2021 at 7:27
0

As you said, Managed Metadata column is not supported by "Show or hide columns in a list or library form".

I also try to check if there is a way to hide one column in view formatting, however, the short answer is no.

Currently, we could only hide the column value based on managed metadata column with column formatting.

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "debugMode": true,
  "elmType": "div",
  "txtContent": "@currentField",
  "style": {
    "display": "=if([$Managed] =='Assembly 1','flex','none')"
  }
}

Result for your reference:

enter image description here

2
  • Unless I am misunderstanding something, I am not sure if this answer is relevant to the question - I am trying to conditionally show a field in a list form (not applying column formatting). Apologies if I am misunderstanding something. Aug 3, 2021 at 7:28
  • 1
    Sorry for misunderstanding your question, per my test and research, there is no OOB way to hide one column based on managed metadata column.
    – Julie_MSFT
    Aug 3, 2021 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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