Table Model Refresh

  • 1
  • Question
  • Updated 3 years ago
I have a read-only table set up with conditions on the model associated with it and then I have the feature set up to view the record details in a popup. If I use the search feature within the table and select a record to edit, the record appears in the popup and then I make a change to the record so that it no longer meets the conditions of the model of the table behind the record. When I save the record I would like the table behind the record to no longer include this record that I just edited that no longer fits in the condition of the model, but for the search criteria to stay. I thought about doing a redirect after save, but this clears what was in the search box. Any ideas of how to make this happen?
Photo of Nate Gilbertson

Nate Gilbertson

  • 1,194 Points 1k badge 2x thumb

Posted 4 years ago

  • 1
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Good news for you Nate.   Our new Action framework makes this a snap!  You will need to have the new 5.6 version of Skuid installed in a sandbox.  We pushed it to most sandboxes on Friday night,  or you can get it from   skuidify.com/skuidreleases.   We are still polishing the edges, so don't reccomend putting it in production org yet.  But if you are living on the edge.....

Anyway - here is what you do...

1. Go to your "view record details popup"  and add a page title.  In that title add a button with type "run multiple actions"   (you can also remove the save and cancel
buttons from the details field editor).
 

2.  Set up the actions as follows: 

  • Save Model(s) -- save the model driving the table and the details. 
  • Query Model -- refresh the model in the table
  • Close all Popups

In my testing - this did exactly what you were after.  I hope it works for you.. 
Photo of Nate Gilbertson

Nate Gilbertson

  • 1,194 Points 1k badge 2x thumb
Wow, that is awesome! Thank you so much for the help.
Photo of Jennifer Harris

Jennifer Harris

  • 182 Points 100 badge 2x thumb
This functionality is not working for me from within a wizard. I have a javascript which saves selected records from a table of account contacts to meeting attendees. Once the contact is saved to the meeting attendees, that contact should no longer appear in the list of account contacts to choose from. I even added the Empty Model and Query Model actions against the Meeting Attendees model after the javascript runs to add the selected records. The table empties and reloads, but still with the contact(s) that should be omitted. If I reload the whole page, the filter is applied correctly and the account contacts shows only the relevant records. Is there some sort of limitation because I am using this within a wizard step?
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
I'm not sure you need any Javascript.  I've built a page that does this purely with action framework steps.  It should also work within a wizard process.  

I think the key issjues is  going to be:  Ordering your models in the right sequence so that as they are requeried,  the atendees are correct so that only contacts that are not in the attedees list are shown.  

The sequence I used is kicked off from a row action on the Contact Table.  It does the following things. 
1. Create new row in Attendees model - and passes the Contact ID into that record. 
2. Save Model Changes.  (Meeting needs to be saved here,  or previously)
3. Query the Models - first Atendees and then Contacts. 

Here is the XML for my test page. 

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">
<models>
<model id="Meeting" limit="1" query="false" createrowifnonefound="true" sobject="Event" doclone="" type="">
<fields>
<field id="Subject"/>
<field id="ActivityDate"/>
<field id="StartDateTime"/>
<field id="EndDateTime"/>
</fields>
<conditions/>
<actions/>
</model>
<model id="Attendees" limit="20" query="true" createrowifnonefound="false" sobject="EventRelation" doclone="" type="">
<fields>
<field id="Relation.FirstName"/>
<field id="Relation.LastName"/>
<field id="RelationId"/>
<field id="Relation.Name"/>
</fields>
<conditions>
<condition type="modelmerge" value="" field="EventId" operator="=" model="Meeting" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
</conditions>
<actions/>
</model>
<model id="Contacts" limit="20" query="true" createrowifnonefound="false" sobject="Contact">
<fields>
<field id="Name"/>
<field id="Title"/>
<field id="AccountId"/>
<field id="Account.Name"/>
</fields>
<conditions>
<condition type="param" value="Id" field="AccountId" operator="=" enclosevalueinquotes="true" novaluebehavior=""/>
<condition type="modelmerge" value="" field="Id" operator="not in" model="Attendees" enclosevalueinquotes="true" mergefield="RelationId" novaluebehavior="deactivate" state="" inactive="false"/>
</conditions>
<actions/>
</model>
</models>
<components>
<pagetitle model="Meeting">
<maintitle>New Meeting for {{$Model.Contacts.data.0.Account.Name}}</maintitle>
<subtitle>
<template>{{Model.label}}</template>
</subtitle>
<actions/>
</pagetitle>
<panelset type="standard" scroll="">
<panels>
<panel type="left" width="400">
<components>
<skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="false" showexportbuttons="false" pagesize="10" createrecords="false" model="Contacts" buttonposition="" mode="readonly" emptysearchbehavior="query">
<fields>
<field id="Name" valuehalign="" type=""/>
<field id="Title"/>
</fields>
<rowactions>
<action type="multi" label="Add to Meeting" icon="sk-icon-arrow-right">
<actions>
<action type="createRow" model="Attendees" appendorprepend="prepend" defaultmodefornewitems="edit">
<defaults>
<default type="fieldvalue" field="RelationId" enclosevalueinquotes="true" value="{{Id}}"/>
</defaults>
</action>
<action type="save">
<models>
<model>Meeting</model>
<model>Attendees</model>
</models>
</action>
<action type="requeryModels" model="Contacts" behavior="standard">
<models>
<model>Attendees</model>
<model>Contacts</model>
</models>
</action>
</actions>
</action>
</rowactions>
<massactions usefirstitemasdefault="true"/>
<views>
<view type="standard"/>
</views>
<searchfields/>
</skootable>
</components>
</panel>
<panel>
<components>
<skootable showconditions="true" showsavecancel="false" searchmethod="server" searchbox="false" showexportbuttons="false" pagesize="10" createrecords="true" model="Attendees" buttonposition="" mode="read" instantfilters="true" emptysearchbehavior="query">
<fields>
<field id="Relation.Name" 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>
<searchfields/>
</skootable>
</components>
</panel>
<panel type="left" width="500">
<components>
<basicfieldeditor showheader="true" showsavecancel="false" model="Meeting" buttonposition="" mode="edit" layout="">
<columns>
<column width="100%">
<sections>
<section title="Section A" collapsible="no">
<fields>
<field id="Subject"/>
<field id="StartDateTime"/>
<field id="EndDateTime"/>
</fields>
</section>
</sections>
</column>
</columns>
</basicfieldeditor>
</components>
</panel>
</panels>
</panelset>
</components>
<resources>
<labels/>
<css/>
<javascript/>
</resources>
</skuidpage>


Hopefully this will work for you... 
Photo of Jennifer Harris

Jennifer Harris

  • 182 Points 100 badge 2x thumb
Thanks, Rob - your example still isn't working for me as the contact that I add as attendee isn't removed automatically from the table of contacts shown on the page.
I outlined the record that should have been removed from the table of shown contacts after the Model was (re)queried by the row action.
Does it work for you? Is it just me??  :)  This little glitch of mine is bringing me a slow death...

Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
In my org the contact is moved over from the available contacts to the event relations.  It works for me.  So why not you... 

Would you mind granting login rights to Skuid for your org, and then sending an email to support@skuidify.com with your ORG ID and the name of this new page you created?   I'd like to take a look at what is going on.. 
Photo of Jennifer Harris

Jennifer Harris

  • 182 Points 100 badge 2x thumb
Hi Rob, the contact gets moved over, but not removed from the list of contacts in the contact table. Table A = Contacts, Table B = Event Attendees. Selected contact from Table A gets added to Table B, but the refresh of Table A does not remove the contact. At least not in my page. I have granted Skuid login rights to my dev org, and will email that Org ID to support. Thanks!