Create Row Action results in inconsistent default values

Hello -

When using the action framework to create a new row that specifies a default value on a reference field, the “reference” field counterpart contains a different value when the row added is the first row in the target model vs. any subsequent row.

Steps to Reproduce:

  1. Create a new Account View page (stock)
  2. Add Phone field to Account model
  3. Add Contact models - Do not specify any conditions
  4. Add AccountId, Account.Name, Account.Id, Account.Phone fields to contact model
  5. Add a contacts table including fields for Account.Name and Account.Phone
  6. Add a global action “Add New” that runs multiple actions. Add a create row action specifying a default for AccountId to {{$}}
  7. Identify an account that has a phone number field value but does not contain any contacts
  8. Preview the page using account from #7
  9. Click “Add new” - You will see both Account Name & Account Phone
  10. Click “Add new”

Actual Result
Account Phone is blank

Expected Result
Account Phone should have a value

Skuid appears to be looping through to find a row that contains an “Account” field and if it finds one, it uses the “Name” and applies only the “Name” to the “Account” on the contact. If it can’t find a row in Contacts with the same AccountId, it then looks through all models on the page for an “Account” model (using keyPrefix) and takes the “Account” field from there if it finds an account with the same Id. This results in a “full copy” of “__r” on the first record, but only the “Name” on subsequent records.

I can’t remember exactly, but I believe there was a thread a while back that indicated the “__r” would need to be established programmatically and that default values would only ever get “Name” when reference field is involved. Even if this is the case though, the behavior should be consistent on first row and subsequent rows otherwise UI rendering is different.

Ideally, the full “__r” can be retrieved from either another row in the Contacts model (instead of just the name) or from the keyPrefix lookup for the first one. This would avoid having to programmatically set the “__r” while also solving the problem of inconsistancy between first and subsequent records.

Sample XML

<skuidpage unsavedchangeswarning="yes" showsidebar="true" showheader="true" tabtooverride="Account">   <models>
      <model id="Account" limit="1" query="true" createrowifnonefound="false" sobject="Account">
            <field id="Name"/>
            <field id="CreatedDate"/>
            <field id="Id"/>
            <field id="Phone"/>
            <field id="Type"/>
            <field id="Description"/>
            <condition type="param" enclosevalueinquotes="true" operator="=" field="Id" value="id"/>
      <model id="ContactWithCondition" limit="1" query="false" createrowifnonefound="false" sobject="Contact" doclone="" type="">
            <field id="Account.Name"/>
            <field id="Account.Id"/>
            <field id="Account.Phone"/>
            <condition type="modelmerge" value="" field="AccountId" operator="=" model="Account" enclosevalueinquotes="true" mergefield="Id" novaluebehavior="noquery"/>
      <model id="ContactWithDefault" limit="1" query="false" createrowifnonefound="false" sobject="Contact" doclone="" type="">
            <field id="AccountId"/>
            <field id="Account.Name"/>
            <field id="Account.Id"/>
            <field id="Account.Phone"/>
            <field id="Name"/>
            <field id="FirstName"/>
      <pagetitle model="Account">
      <skootable showconditions="true" showsavecancel="true" searchmethod="server" searchbox="true" showexportbuttons="false" pagesize="10" createrecords="false" model="ContactWithDefault" buttonposition="" mode="edit">
            <field id="FirstName" valuehalign="" type=""/>
            <field id="Account.Name" valuehalign="" type=""/>
            <field id="Account.Phone" valuehalign="" type=""/>
         <massactions usefirstitemasdefault="true"/>
            <view type="standard"/>
         <actions defaultlabel="Global Actions" defaulticon="sk-icon-magic" usefirstitemasdefault="true">
            <action type="multi" label="Add New" icon="sk-icon-magic">
                  <action type="createRow" model="ContactWithDefault" appendorprepend="prepend" defaultmodefornewitems="edit">
                        <default type="fieldvalue" value="{{$}}" field="AccountId" enclosevalueinquotes="true"/>


This will be fixed in Superbank Patch 9, due out at the end of this week (June 5).

Awesome, thanks Zach.

Do you know yet which way the patch will behave - will both first & subsequent get just “Name” or will they both get the full “__r” copy?  +1 for full “__r” (if reasonable effort) so that it’s consistent with the way model conditions (field in another model) defaults get applied as well :slight_smile:


The full related record will be applied to the new record. There was one branch of code where only the “Name” field value was being applied, but this has now been corrected so that all branches apply the full related record.

Awesome news, thanks again!

This has been fixed as of Superbank Patch 9, now available from Skuid Releases.

Initial smoke tests confirm this appears to be resolved in 6.8.20.

Thank you!