Can we add filter to Table filter in order show only values of records present in the table.

  • 1
  • Question
  • Updated 1 year ago
  • Answered
Hi Team

Can we have a filter option to show only values present in records displayed in table for Eg: If a table showing opportunities and a Owner field is added as filter then when i try to search in filter i'm getting in-active users who were not part of the organization and result for them would always be none(in my case).

If I would have a filter that can be applied for this (Owner filter) then i can avoid inactive users from being displayed in search values. Can this be possible?

Current Work Around:
load values into filter from another model (In my case active User Model with active users) by selecting the manual options available along with the condition of model associated with table to be effected.

let me know if you need more info.

Thanks in advance.

Regards,
Chandra
Photo of Chandra Sekhar

Chandra Sekhar

  • 496 Points 250 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Stephen Sells

Stephen Sells, Official Rep

  • 16,856 Points 10k badge 2x thumb
Have you gone through our filter documentation?

It seems highly suspect to me that upon adding a filter you're seeing records that were previously not viewed. That tells me that something isn't set up correctly. When you filter, it should be narrowing down the results that are coming in - not widening them.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,436 Points 10k badge 2x thumb
Chandra,

You can add a model to your page to get the list of Owners from the Opportunities shown on your page.  The model will aggregate owners with a condition that limits the Opportunities to the ones in your table.  You then add a condition on the Owner field and make it filterable.  Then add your table filter and set it to use Source: Rows in a Model.

Here is a page that demonstrates what I think you are trying to do.

Thanks,

Bill

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" useviewportmeta="true" showsidebar="true" showheader="true" tabtooverride="Opportunity">
    <models>
        <model id="Opportunity" limit="100" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Opportunity" type="">
            <fields>
                <field id="Name"/>
                <field id="CreatedDate"/>
                <field id="OwnerId"/>
                <field id="Owner.Name"/>
                <field id="Amount"/>
                <field id="CloseDate"/>
            </fields>
            <conditions>
                <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="OwnerId" fieldtargetobjects="User" state="filterableoff" inactive="true" name="OwnerId"/>
            </conditions>
            <actions/>
        </model>
        <model id="OppOwners" limit="" query="true" createrowifnonefound="false" datasource="salesforce" type="aggregate" sobject="Opportunity">
            <fields/>
            <conditions>
                <condition type="modelmerge" value="" field="Id" operator="in" model="Opportunity" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="deactivate"/>
            </conditions>
            <actions/>
            <groupby method="simple">
                <field id="OwnerId" name="ownerId"/>
                <field id="Owner.Name" name="ownerName"/>
            </groupby>
        </model>
    </models>
    <components>
        <pagetitle model="Opportunity" uniqueid="sk-W7hqS-82">
            <maintitle>
                <template>{{Model.labelPlural}}</template>
            </maintitle>
            <subtitle>
                <template>Home</template>
            </subtitle>
            <actions>
                <action type="savecancel" uniqueid="sk-W7hqR-81"/>
            </actions>
        </pagetitle>
        <skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="Opportunity" mode="read" allowcolumnreordering="true" uniqueid="sk-W7hqm-92">
            <fields>
                <field id="Name" hideable="true" allowordering="true" uniqueid="fi-W7gxg-242" valuehalign="" type=""/>
                <field id="Amount" hideable="true" uniqueid="fi-W7ojW-142" decimalplaces="" valuehalign="" type="" allowordering="true"/>
                <field id="CloseDate" hideable="true" uniqueid="fi-W7ojW-141" valuehalign="" type="" allowordering="true"/>
                <field id="OwnerId" hideable="true" uniqueid="fi-W7l7D-125" valuehalign="" type=""/>
            </fields>
            <rowactions>
                <action type="edit"/>
                <action type="delete"/>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="massupdate"/>
                <action type="massdelete"/>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
            <filters>
                <filter type="select" filteroffoptionlabel="All Owners" createfilteroffoption="true" affectcookies="true" autocompthreshold="25" conditionsource="manual" labelmode="no" condition="OwnerId">
                    <sources>
                        <source type="model" effectsbehavior="justdefault" model="OppOwners">
                            <labeltemplate>{{{ownerName}}}</labeltemplate>
                            <valuetemplate>{{ownerId}}</valuetemplate>
                        </source>
                    </sources>
                </filter>
            </filters>
        </skootable>
    </components>
    <resources>
        <labels/>
        <css/>
        <javascript/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>