skuid table filter show picklist values from record type that users does not have access to

  • 1
  • Problem
  • Updated 3 months ago
  • Not a Problem
  • (Edited)
We have several record types on an object and we have built the pages to control the visibility of the picklist values based on the record type. 

On table filters end user is seeing all the active picklist values on a field  and not record type corresponding picklist values.

Is there any work around to overcome this issue, as this will be a major issue for our end users.
Photo of Praveen Pannala

Praveen Pannala

  • 580 Points 500 badge 2x thumb

Posted 7 months ago

  • 1
Photo of Bill McCullough

Bill McCullough, Champion

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

What I do is build an aggregate model on Opportunities that groups by the field that I want to filter.  I setup a filterable condition on the field and then use the aggregate model to provide the 'pick list' values for the filter.

Here is a sample page that demonstrates this using the Stage field on Opportunities.

Thanks,

Bill

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" useviewportmeta="true" showsidebar="true" showheader="true" tabtooverride="Opportunity">
    <models>
        <model id="OppStages" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Opportunity" type="aggregate">
            <fields/>
            <conditions/>
            <actions/>
            <groupby method="simple">
                <field id="StageName" name="stageName"/>
            </groupby>
        </model>
        <model id="Opportunity" limit="100" query="true" createrowifnonefound="false" datasource="salesforce" sobject="Opportunity">
            <fields>
                <field id="Name"/>
                <field id="CreatedDate"/>
                <field id="StageName"/>
            </fields>
            <conditions>
                <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="StageName" operator="=" state="filterableoff" inactive="true" name="StageName"/>
            </conditions>
            <actions/>
        </model>
    </models>
    <components>
        <pagetitle model="Opportunity" uniqueid="sk-2A_j-199">
            <maintitle>
                <template>{{Model.labelPlural}}</template>
            </maintitle>
            <subtitle>
                <template>Home</template>
            </subtitle>
            <actions>
                <action type="savecancel" uniqueid="sk-2A_j-197"/>
            </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-2A_j-213">
            <fields>
                <field id="Name" hideable="true" allowordering="true" uniqueid="fi-2A_c-930"/>
                <field id="StageName" hideable="true" uniqueid="fi-2A_j-255"/>
                <field id="CreatedDate" hideable="true" allowordering="true" uniqueid="fi-2A_c-931"/>
            </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" createfilteroffoption="true" affectcookies="false" autocompthreshold="25" conditionsource="manual" filtermethod="server" labelmode="no" condition="StageName" filteroffoptionlabel="All Stages">
                    <sources>
                        <source type="model" effectsbehavior="justdefault" model="OppStages">
                            <labeltemplate>{{{stageName}}}</labeltemplate>
                            <valuetemplate>{{stageName}}</valuetemplate>
                        </source>
                    </sources>
                </filter>
            </filters>
        </skootable>
    </components>
    <resources>
        <labels/>
        <css/>
        <javascript/>
        <actionsequences uniqueid="sk-2A_j-252"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>
Photo of Praveen Pannala

Praveen Pannala

  • 580 Points 500 badge 2x thumb
Thank you Bill for responding on this.

We were using same solution but it was impacting performance of our pages, so we want to use standard approach. Moreover aggregate models do not support multi select picklist.
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,426 Points 10k badge 2x thumb
Praveen,

The aggregate model does slow things a bit.  If you don't have a lot of changes to your pick list fields, you can set the options manually on the filter.

You can also manually edit the XML of the filter to enable the multiselect option.

Just change this:  <filter type="select"

To this:  <filter type="multiselect"

Thanks,

Bill
Photo of Praveen Pannala

Praveen Pannala

  • 580 Points 500 badge 2x thumb
Thank you Bill.
Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,040 Points 10k badge 2x thumb
Praveen and Bill, in the latest release of Skuid (11.1.x) Multi-select filters now support manually-created sources or a model as a source for the filtering options. (See release notes here.)

Praveen, does this give you a way to employ Bill's suggestion declaratively?
Photo of Bill McCullough

Bill McCullough, Champion

  • 12,426 Points 10k badge 2x thumb
Mark,

Thanks for pointing that out.  I am glad that it is now 'declarative'.

Best!

Bill
Photo of Praveen Pannala

Praveen Pannala

  • 580 Points 500 badge 2x thumb
I have implemented it using aggregate model, now running into a different issue. We are skuid version 11.0.2