I have a lookup to a table on a form and have been given a requirement to automatically do a wildcard search so that records containing the search term are shown rather than records that only begin with the search term.
What I was wondering was if there is a low code way of achieving this?
The ways that I know of using code are a plugin or a PCF Control.
There may be a solution using a script or plugin, but there's a low-code option that I've used before to enhance the functionality of Model-Driven Apps (I'm assuming here that you're talking about how to improve the lookup function on a Model-Driven App form). It's a little bit involved, but allows for a lot more flexibility if you want to add some other things besides just the more flexible search.
Embed A Small Canvas App
What I like to do is make and embed a small canvas app. The canvas app's Search() function does the "wildcard" or substring type search you describe and is more useful. Also, using a small canvas app allows you to prefilter the list of records on the lookup column's related table based on other known factors. It also allows you to give the user different controls to filter the list of related records.
E.g. in my example below, I'll pre filter the list of cities based on the state (if we know it already).
Set up your canvas app to lookup the record it's embedded on when loaded by reference to the "id" parameter in the url (we'll tell the Model-Driven App to give us this ID later on). Do this by adding a code to the OnVisible property of the screen, something like
Set up your canvas app to display a gallery of related records
Give it a text input search control
Put a Search() expression around your datasource in the gallery (and any necessary filters)
​​​​​​​
Give the user a button or control to select the record after they search
Give the user a final confirm button that patches the selected related record to the lookup field.
Click the share button on your app, copy the link
Add an "External Website" component to your form (there is a "Canvas App" component, but I prefer to just use the "External website" component.
Paste the url to the "External Website" component and make sure you check the "Pass record object-type code and unique identifyer as parameters" option.
Publish your form and load it in your app to test.
You'll probalby want to tweak your canvas app to make it responsive to different browser sizes, etc.
Search and click on the city record I want:
Click the "Set Lookup" / "confirm" button. The app can give you a confirmation and a note to reload the form if you like.
Hope that helps!
Was this reply helpful?YesNo
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.