Hello! I’m using a table and 2 of my fields are template fields that are pulling in text from a child object in SF. Ideally, i’d like to be able to filter based on text or phrase in the template field. So i’d like to say “show me all the records where field contains text _____”. Any suggestions?
Hi Nate,
That’s a pretty interesting question, and I think I have one possible solution for you, though there certainly might be others. One caveat - the solution I’m suggesting only works if the text from the child object is a String field (or fields) and not a Textarea field (or fields), since Salesforce doesn’t allow filtering on Textareas. I use a combination of a UI only model and an action sequence to create a search experience similar to a table search. Here’s some background on how I set it up:
To approximate your parent and child relationship, I have a model on accounts that also pulls in the opportunity child relationship and a string field from opportunities
On the page I have a table on the account model, that shows some of the opportunity details, including the string field
To achieve the search:
- My account model (parent model) has a subquery condition on it where the Account Id is in the result of a subquery that is joined to the opportunity object by the AccountId field (on the opportunity object). That subquery has a condition on it where the string field on opportunity contains a single specified value. Both of those conditions are filterable default off:
I have a UI Only model with a UI only text field called Search on it
I have an action sequence (called Search Account Using Opp Fields) that Activates the subquery condition, and then activates and sets the value of the condition on the subquery. The value is {{$Model.UIOnly.data.0.Search}} (Here’s some info about merge syntax if you haven’t seen it before)
To put it all together, I added a field editor above my account table that looks at the UI only model and only has the Search field on it. The field editor’s default mode is edit and I don’t show section headers or really have a field label, so that it looks more like a search box. You could also add Placeholder text to the field to make it more like a search box
I have a Search and Clear Filters button to the right of the field editor. The Search button runs the Search Account Using Opp Fields action sequence and then queries the account model. The Clear Filters button deactivates both conditions and queries the account model
In my example I only “search” one field on opportunity, but if you wanted to be able to look through more fields than that, you could add additional conditions on the subquery for each field (setting it to field contains single specified value), set the Subcondition logic on the top level condition to be 1 OR 2 OR 3 etc. and add another Activate and Set Value of Condition action in the action sequence, setting the value to be the same as the other condition ({{$Model.UIOnly.data.0.Search}})
Thanks!
Amy
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.