redirect to record if both Fields match existing record

  • 1
  • Question
  • Updated 3 years ago
  • Answered
Hi ,

I have an idea, and no really sure if feasible.

On my accounts i have 2 fields named : 'usercode' and another 'subuser'

I would like to be able to create a Skuid page , where a user would input those 2 values, and skuid would return the account detail page if both those parameters match exactly an existing account. (i do not want the user to be able to lookup all the usercodes and subusers from picklist, popup....just to type in the 2 fields, and hit "search" or "save" button and if a match is found to be redirected to the record's detail page. if not match is found, i would just show "an error message"


Any ideas?

If my explanation is not clear, feel free to ask anything

Thank you
Photo of Dave

Dave

  • 5,538 Points 5k badge 2x thumb

Posted 3 years ago

  • 1
Photo of Skuidward Tentacles (Raymond)

Skuidward Tentacles (Raymond), Champion

  • 17,224 Points 10k badge 2x thumb
So what if you created an account detail page with an account model that has two conditions that are equal to URL parameters usercode and subuser.
Then you could create a page that has two UI only fields of UserCode and SubUser and a button. The user would enter their code and sub user in the UI only fields then the button would redirect them to the URL of your account detail page that would include "&usercode={{$Model.YOURMODEL.data.0.UserCode}}&subuser={{Model.YOURMODEL.data.0.SubUser}}" at the end of the URL.
The account detail page will only load records that match those URL parameter. If no records match those parameters, then no records would display. You could then have a template or rich text that is set to conditionally render if no records are in your account model. This would display your error message if no records match the UserCode/SubUser combo.
You could also do this using a page include and display it inline or in a popup.
Photo of Matthias

Matthias

  • 628 Points 500 badge 2x thumb
This little example will (simplified to fit on one skuid page) show how it can be done:

<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" showheader="true">
   <models>
      <model id="User" limit="20" query="false" createrowifnonefound="false" adapter="" type="" sobject="User">
         <fields>
            <field id="FirstName"/>
         </fields>
         <conditions>
            <condition type="modelmerge" value="" field="FirstName" state="filterableoff" inactive="true" name="FirstName" operator="contains" model="UiOnly" enclosevalueinquotes="true" mergefield="Filtervalue" novaluebehavior="deactivate"/>
         </conditions>
         <actions/>
         <groupby method="simple"/>
      </model>
      <model id="UiOnly" limit="20" query="false" createrowifnonefound="true" adapter="" type="" sobject="Account" doclone="">
         <fields>
            <field id="LookFor" uionly="true" displaytype="TEXT"/>
         </fields>
         <conditions/>
         <actions/>
      </model>
   </models>
   <components>
      <basicfieldeditor showheader="true" showsavecancel="false" showerrorsinline="true" model="UiOnly" buttonposition="" uniqueid="sk-2Zjmgi-384" mode="edit">
         <columns>
            <column width="100%">
               <sections>
                  <section title="Section A" collapsible="no" showheader="false">
                     <fields>
                        <field id="LookFor" valuehalign="" type="">
                           <label>Please enter a first name/ part of a first name</label>
                        </field>
                     </fields>
                  </section>
               </sections>
            </column>
         </columns>
      </basicfieldeditor>
      <pagetitle uniqueid="sk-2ZgcYG-119" model="UiOnly">
         <maintitle>
            <template>{{Name}}</template>
         </maintitle>
         <subtitle>
            <template>{{Model.label}}</template>
         </subtitle>
         <actions>
            <action type="multi" label="Apply">
               <actions>
                  <action type="setCondition" model="User" condition="FirstName" value="{{LookFor}}"/>
                  <action type="requeryModel" model="User" behavior="standard"/>
               </actions>
            </action>
         </actions>
      </pagetitle>
      <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="true" model="User" buttonposition="" mode="read" uniqueid="sk-2Z5wK1-77">
         <fields>
            <field id="FirstName"/>
         </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/>
      </skootable>
   </components>
   <resources>
      <labels/>
      <javascript/>
      <css/>
   </resources>
   <styles>
      <styleitem type="background" bgtype="none"/>
   </styles>
</skuidpage>
(Edited)