Vue normale

Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.
À partir d’avant-hierFlux principal

Pre-Filtering Multi-table Lookups

A very common requirement which is being request frequently is having a lookup table that points to multiple tables similar to the out of the box customer lookup type that can point out to either a contact or account.

This feature was released in July 2021 but I hadn’t the chance to try it till now and it came up with a challenge to using it which is Prefiltering this new type of lookup and I have searched and googled and everything and I really could not find someone who tried it, Many articles pointing out how to create this column typeand how it looks like but none really explained how to add prefiltration so it does not display all the records but show them as filtered based on a predefined criteria.

This article by Nick Doelman has a very good explanation to Polymorphic lookups.

This article describes how to do pre-filtration to a normal lookup type.

Also with the help of the XRMToolbox Polymorphic Lookup Creator it was very easy to create the polymorphic lookup which for the sake of the example below my lookup needed to point to either contact or user tables with a pre-search filter where first name = Mira

SO when it came to the prefiltration it was pretty easier than I thought and I just tried it and to my Surprise it worked, so all I did is used the normal way for lookup filtration but added a custom filter for each of my tables.

function FilterPolymporphicLookup(executionContext){
	formContext = executionContext.getFormContext();
formContext.getControl("new_polymorphiclookupid").addPreSearch(filterPolymorphic);
}
 function filterPolymorphic() {

    var contactFilter = "<filter type='and'><condition attribute='firstname' operator='eq' value='Mira' /></filter>";
    var userFilter = "<filter type='and'><condition attribute='firstname' operator='eq' value='Mira' /></filter>";

    formContext.getControl("new_polymorphiclookupid").addCustomFilter(contactFilter, "contact");
    
    formContext.getControl("new_polymorphiclookupid").addCustomFilter(userFilter, "systemuser");

}

Multilookup

miraghaly

Pre-Filtering Multi-table Lookups

A very common requirement which is being request frequently is having a lookup table that points to multiple tables similar to the out of the box customer lookup type that can point out to either a contact or account.

This feature was released in July 2021 but I hadn’t the chance to try it till now and it came up with a challenge to using it which is Prefiltering this new type of lookup and I have searched and googled and everything and I really could not find someone who tried it, Many articles pointing out how to create this column typeand how it looks like but none really explained how to add prefiltration so it does not display all the records but show them as filtered based on a predefined criteria.

This article by Nick Doelman has a very good explanation to Polymorphic lookups.

This article describes how to do pre-filtration to a normal lookup type.

Also with the help of the XRMToolbox Polymorphic Lookup Creator it was very easy to create the polymorphic lookup which for the sake of the example below my lookup needed to point to either contact or user tables with a pre-search filter where first name = Mira

SO when it came to the prefiltration it was pretty easier than I thought and I just tried it and to my Surprise it worked, so all I did is used the normal way for lookup filtration but added a custom filter for each of my tables.

function FilterPolymporphicLookup(executionContext){
	formContext = executionContext.getFormContext();
formContext.getControl("new_polymorphiclookupid").addPreSearch(filterPolymorphic);
}
 function filterPolymorphic() {

    var contactFilter = "<filter type='and'><condition attribute='firstname' operator='eq' value='Mira' /></filter>";
    var userFilter = "<filter type='and'><condition attribute='firstname' operator='eq' value='Mira' /></filter>";

    formContext.getControl("new_polymorphiclookupid").addCustomFilter(contactFilter, "contact");
    
    formContext.getControl("new_polymorphiclookupid").addCustomFilter(userFilter, "systemuser");

}

Getting Specific Files And IDs In SharePoint Using Power Automate

I encountered an issue when trying to filter a a file by filename, that was in a SharePoint document library. When needing to get a specific SharePoint file ID. It can be troublesome to filter the Files. For example Using a 'Get files' action we can see that the properties of the file are encased inside {} meaning that SharePoint is using some calculation on the Document Library to create these fields.

feature

jcook127001

Filtering SharePoint News Pages with Metadata

This is a quick tip about a SNAFU which caught me up today. I got to do a “Doh!” in front of a client, which is always fun. Hopefully this will save you the same embarrassment.

Home Simpson saying "Doh!"

Filtering News pages based on some metadata applied to the pages is a thing, and has been for a good, long time. I knew it should work, and pretty easily at that.

When I was on the call, I had added a metadata column to the Site Pages library. Simple. I went and put the page with the News Web Part into edit mode and looked in the Filter section for Page properties. No joy. Instead I was seeing:

Managed Properties are awesome, and I set them up all the time so I can build search-driven solutions, usually with the PnP Modern Search Web Parts, which, as I’ve said before, are the bees knees. But I knew there should be an option to filter based on Page properties instead. Had something changed? Was it better? I wasn’t sure.

I fired up my MVP communication channel and asked if things had indeed changed. As I expected, Susan Hanley (@susanhanley) responded almost right away.

Look to see what the Source is for News. When it is a single site (i.e., the site you are on), you can filter using Page properties. When you are selecting news from multiple sites, you will not see the Page Properties option – just Managed property.

Doh! I hadn’t even though to check that setting! A simple change at the top of the News Web Part properties to use This site as the source, and Page properties was back where I expected it.

This makes sense if you think about it. The Page properties in Site Pages libraries probably wouldn’t be consistent across multiple sites, so Managed properties makes more sense. Within one site, the Site Pages library is a single source, so has to be consistent with itself.

I do think there could be some in-Web-Part assistance for this with a slightly better UI, though. Maybe just an info bubble like the Enable audience targeting section right below it?


As you might expect, Greg Zelfond (@gregoryzelfond) has a great post about all this if you want to understand it better:

How to manage categories of news using custom metadata – SharePoint Maven

❌
❌