UFM fallback values

Hello, first-time poster here hoping I can pick some of your big brains.

I have just updated my project from v13 to v17, and need to update the labels for my block list items from angular to UFM. I am wanting to render the heading property in the label, however where this is a non-mandatory field I need a fallback to another property, which in my current case has the alias bodyCopy.

The docs show that a fallback filter exists, which is great, however I CAN’T FOR THE LIFE OF ME work out what kind of data it will accept? I’ve referred to the docs, the forums and Joe Glombek’s super useful blog (this particular issue aside…) , and have tried a variety of values as follows:

Just the alias name:

#ImageAndContentComponent_${ $index } - ${umbValue: heading | fallback: bodyCopy }

Alias name as js expression:

#ImageAndContentComponent\_${ $index } - ${umbValue: heading | fallback: ${ bodyCopy } }

Alias name as a umbValue (with ref to Trying to be clever with UFM fallbacks ):

#ImageAndContentComponent\_${ $index } - ${umbValue: heading | fallback: {umbValue: bodyCopy} }

I then gave up with the fallback filter and tried a js expression (again going off Søren’s responses, I’m guessing is a relatively new feature) :
#ImageAndContentComponent_${ $index } - ${ heading.length > 0 ? heading : bodyCopy }

All to no avail. I’m hoping someone is going to tell me I’m doing something really stoopid, and I can get this working in no time, but any thoughts / suggestions would be much appreciated! :heart_hands:

p.s. I will be extra happy if you tell me I don’t have to create my own filter.

(umb 17.2.2)
I did get it to work in a collection view… (with ufm and not ufm expression though)


I wonder if it’s that the fallback filter is only available on ufm and not ufm expressions?

for ufm expressions.
${ value.length > 0 ? value : "N/A" }

works.. but can’t seem to have it fallback to another property like you are after.

1 Like

So with blocks…
again with ufm.. not expresssions- fallback to text working
but again only if a constant string and not another property


Seems to work with expressions though..



1 Like

Thanks so much for looking into this for me @mistyn8! Interesting that you were able to return a property using the expression, I’ll have another play and see if I was doing something silly.

Would defo be useful for the fallback filter to accept doctype properties, but from talking to my colleague @OwainWilliams it sounds like it might not be a priority at the mo.

Thanks again!

Seems like I’m also now running to similar issues and limitations or maybe even a bug.

Trying to get the value of a MemberPicker and no matter what I try, I always just get the member key e.g.

umbValue: {umbValue:person} - person is the alias of the MemberPicker

I thought maybe {umbValue.person.firstName} or {umbValue.person.name} might work but it doesnt.

According to the docs {umbContentName:person} should work with Memberpickers

"Content Name

The Content Name component will render the name of a content item, (either Document, Media or Member), from the value of a given property alias. Multiple values will render the names as a comma-separated list.

The alias prefix is umbContentName. An example of the syntax is {umbContentName: pickerAlias}, which would render the component as <ufm-content-name alias="pickerAlias"></ufm-content-name>.

The Content Name component supports content-based pickers, such as the Document Picker, Content Picker (formerly known as Multinode Treepicker), and Member Picker. Support for the advanced Media Picker will be available in an upcoming Umbraco release."

But I don’t even get a value back when I do use {umbContentName:person}

Frustrating to say the least.

sounds like it’s failing to find the correct entity type.. and falling back to the default which is document..

	#getRepository(entityType?: string | null) {
		switch (entityType) {
			case UMB_MEDIA_ENTITY_TYPE:
				if (!this.#mediaRepository) this.#mediaRepository = new UmbMediaItemRepository(this);
				return this.#mediaRepository;

			case UMB_MEMBER_ENTITY_TYPE:
				if (!this.#memberRepository) this.#memberRepository = new UmbMemberItemRepository(this);
				return this.#memberRepository;

			case UMB_DOCUMENT_ENTITY_TYPE:
			default:
				if (!this.#documentRepository) this.#documentRepository = new UmbDocumentItemRepository(this);
				return this.#documentRepository;
		}
	}
}

**Member** {umbValue:member} {umbContentName:member} **Content** {umbValue:content} {umbContentName:content} **Media** {umbValue:media} {umbContentName:media}

resolves for content and media, but not member..

yep entityType is resolved as document for the member guid.

Works for media as we get an object..

but can’t possible distinguish between document and member.. as it’s just a plain guid.

Prob needs to do a we didn’t find the guid in member repository, so now default to documentrepository ??

1 Like

Loving seeing your working and thought process on this Mike. Thanks for the details - never thought about firing up DevTools and digging around that to hit breakpoints etc.

I’m currently looking at a custom extension to try and get member details that way. If I get it working I’ll share a link to the code.

1 Like

ps you can get at the compiled js to play in situe too.. (rather than just dev tools)

from the project folder

dotnet publish --configuration Release --output ../../PublishedSite
cd .\..\..\publishedSite
dotnet www.dll --urls=https://localhost:44315/  --configuration Release --environment Development

gets you a running site at https://localhost:44315/

and
PublishedSite\wwwroot\umbraco\backoffice\packages\ufm\content-name.component-CZi6jNIr.js

1 Like

All filters that take parameters currently only work with components, not expressions. Unfortunately I believe this one is causing some headaches to solve!

This looks like a bug at the moment, so worth raising an issue and/or getting a PR in. Generally HQ have been quick at fixing these oversights!

What I suspect won’t be a part of core (yet) is rendering properties from a picked member other than name. So if you need to do that, a custom UFM Component would be the way to go!

1 Like

So went down the custom UFM component and made it a package

Sent it to the marketplace but still waiting for that to load.

This does the Member lookup which I couldnt get to work in Core. I’ll see if I can make a PR in to Core too but this was needed for a client. :slight_smile:

O.

1 Like