extra row added on popup row action

  • 1
  • Question
  • Updated 2 months ago
  • Answered
I am trying to make a pop up to add a row to a table asking the user to choose a product and add a Quantity then click a row action button to add the choice to the table below the popup.


When I go to the main page, I click a Global action button that launches a popup.

That popup has a search component that feeds a table.

Once the user has chosen a product it shows on the table, The user enters the quantity and on the first click of the "Add to Project" button a blank row is created even though a product and Quantity are in the system.  On the second click the correct Product and Quantity are added as a second line on the table below the pop up.   What is causing the first blank row to be created?   My actions are below. 





Thanks!
Photo of Ambrose Alward

Ambrose Alward

  • 300 Points 250 badge 2x thumb

Posted 3 months ago

  • 1
Photo of Mike Dwyer

Mike Dwyer

  • 3,390 Points 3k badge 2x thumb
Do you have the "Create default row if Model has none" option selected on the OppItem model?
Photo of Ambrose Alward

Ambrose Alward

  • 300 Points 250 badge 2x thumb
It's unchecked.


Photo of Matt Davis

Matt Davis, Employee

  • 654 Points 500 badge 2x thumb
Is the create new rows action adding to the beginning or end of the model? Have you tried removing the create new rows action in your screenshot?
Photo of Ambrose Alward

Ambrose Alward

  • 300 Points 250 badge 2x thumb
Its set to create at the end, When I remove the create new row at the end nothing happens on the click.  

For clarity 

It starts out looking like this:


There are no items listed in the project items in the background.


After the first click of the plus button under new popup



Note nothing in the qty field or the product id 

Second click of the plus action (no other changes) 

The first row is still there but the second row has properly entered the project items

Thanks for all the help!

Photo of Matt Davis

Matt Davis, Employee

  • 654 Points 500 badge 2x thumb
Can you post a copy of the page xml by chance? It would make it a bit easier for me to see what's going on. Your screenshots are good, I just want to see what's going on behind the scenes on each click to see if there are any odd interactions.
Photo of Ambrose Alward

Ambrose Alward

  • 300 Points 250 badge 2x thumb
Of course

<skuidpage showheader="true" personalizationmode="server" showsidebar="true" unsavedchangeswarning="yes" useviewportmeta="true">
    <models>
        <model id="Opps" datasource="salesforce" createrowifnonefound="false" query="true" limit="1" sobject="Opportunity">
            <fields>
                <field id="Id" />
                <field id="Brand__c" />
                <field id="Amount" />
                <field id="IsClosed" />
                <field id="AccountId" />
                <field id="Account.Name" />
                <field id="Contact__c" />
                <field id="Contact__r.Name" />
                <field id="Quote_Status__c" />
                <field id="CreatedDate" />
                <field id="CloseDate" />
                <field id="SAP_DocNum__c" />
                <field id="Name" />
                <field id="Owner.Name" />
                <field id="OwnerId" />
                <field id="Commission_Level__c" />
                <field id="Bill_To_Address__c" />
                <field id="Bill_To_City__c" />
                <field id="Bill_To_Country__c" />
                <field id="Bill_To_State__c" />
                <field id="Bill_To_Zipcode__c" />
                <field id="Ship_To_Address__c" />
                <field id="Ship_To_City__c" />
                <field id="Ship_To_State__c" />
                <field id="Ship_To_Country__c" />
                <field id="Ship_To_Zipcode__c" />
                <field id="Lead_Time__c" />
                <field id="Specifier__c" />
                <field id="Specifier__r.Name" />
                <field id="Freight_Quote__c" />
                <field id="Freight_Quote_Notes__c" />
                <field id="Opportunity_Total__c" />
                <field id="Total_With_Shipping__c" />
                <field id="Sales_Rep__c" />
                <field id="Sales_Rep__r.Name" />
                <field id="Specifier_Sales_Rep__c" />
                <field id="Must_Have_Date__c" />
                <field id="Path_Stage__c" />
            </fields>
            <conditions>
                <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Id" operator="=" novaluebehavior="deactivate" inactive="true" state="filterableoff" />
                <condition type="param" value="id" enclosevalueinquotes="true" field="Id" operator="=" novaluebehavior="deactivate" inactive="false" />
            </conditions>
            <actions />
        </model>
        <model id="OppItem" datasource="salesforce" createrowifnonefound="false" query="true" limit="200" sobject="OpportunityLineItem">
            <fields>
                <field id="SortOrder" />
                <field id="Id" />
                <field id="Name" />
                <field id="ProductCode" />
                <field id="Product2Id" />
                <field id="Product2.Name" />
                <field id="Total_Cost__c" />
                <field id="UnitPrice" />
                <field id="Quantity" />
                <field id="TotalPrice" />
                <field id="Ferrule__c" />
                <field id="Finish__c" />
                <field id="Kick_Plate__c" />
                <field id="Metal_Finish__c" />
                <field id="Metal_Leg__c" />
                <field id="Nailhead__c" />
                <field id="Manufacturer__c" />
            </fields>
            <conditions>
                <condition type="param" value="id" enclosevalueinquotes="true" field="OpportunityId" operator="=" fieldtargetobjects="Opportunity" mergefield="Id" novaluebehavior="deactivate" />
                <condition type="fieldvalue" name="Product2Id" value="{{Id}}" enclosevalueinquotes="true" field="Product2.Id" fieldtargetobjects="Product2" inactive="true" state="filterableoff" />
            </conditions>
            <actions />
        </model>
        <model id="Products" datasource="salesforce" createrowifnonefound="false" query="false" limit="20" sobject="Product2">
            <fields>
                <field id="ProductCode" />
                <field id="Description" />
                <field id="Name" />
                <field id="AddQty" label="Quantity " scale="2" displaytype="DOUBLE" defaultvaluetype="fieldvalue" ogdisplaytype="TEXT" required="true" defaultValue="1" precision="9" uionly="true" />
            </fields>
            <conditions>
                <condition type="fieldvalue" name="Id" value="{{Id}}" enclosevalueinquotes="true" field="Id" inactive="true" state="filterableoff" />
            </conditions>
            <actions />
        </model>
    </models>
    <components>
        <wizard uniqueid="sk-1VCs-211" buttonslocation="top" deferstepcontentsrendering="false">
            <steps>
                <step stepid="step1" steplabel="Step 1">
                    <components>
                        <pagetitle model="Opps" uniqueid="sk-1ZXF-1543">
                            <maintitle>{{Name}}    </maintitle>
                            <actions />
                            <subtitle>{{Path_Stage__c}}</subtitle>
                        </pagetitle>
                        <grid uniqueid="sk-1VEr-473">
                            <divisions>
                                <division behavior="flex" ratio="1" minwidth="100px">
                                    <components>
                                        <skootable model="Opps" uniqueid="sk-1VEt-488" showerrorsinline="true" mode="read" showexportbuttons="false" showsavecancel="false" showconditions="true" searchbox="true" pagesize="10" createrecords="false" buttonposition="" searchmethod="server" responsive="true" allowcolumnreordering="true" alwaysresetpagination="false" hidefooter="false" hideheader="false">
                                            <fields>
                                                <field id="SAP_DocNum__c" uniqueid="fi-1ZRA-663" hideable="true">
                                                    <label>SAP Quote Number </label>
                                                </field>
                                                <field id="Name" uniqueid="fi-1ZIl-608" hideable="true">
                                                    <label>Project Name</label>
                                                </field>
                                                <field id="OwnerId" uniqueid="fi-1ZI--743" hideable="true">
                                                    <label>Owner</label>
                                                </field>
                                                <field id="Opportunity_Total__c" uniqueid="fi-1ZW1-1449" hideable="true" />
                                                <field id="Total_With_Shipping__c" uniqueid="fi-1ZW1-1450" hideable="true" />
                                            </fields>
                                            <rowactions>
                                                <action type="edit" />
                                            </rowactions>
                                            <massactions usefirstitemasdefault="true" />
                                            <views>
                                                <view type="standard" />
                                            </views>
                                            <searchfields />
                                            <renderconditions logictype="and" />
                                        </skootable>
                                        <basicfieldeditor model="Opps" uniqueid="sk-1VFK-541" showerrorsinline="true" mode="read" showsavecancel="true" showheader="true">
                                            <columns>
                                                <column width="33.3%" uniqueid="sk-1VFK-537">
                                                    <sections>
                                                        <section title="Customer Info" uniqueid="sk-1VFK-538" collapsible="open">
                                                            <fields>
                                                                <field id="AccountId" uniqueid="sk-1ZH9-322" pagesize="5" redirecttype="datasourcedefault">
                                                                    <label>Customer</label>
                                                                    <searchfields />
                                                                </field>
                                                                <field id="Contact__c" uniqueid="sk-1ZHf-390" />
                                                                <field id="Brand__c" uniqueid="sk-1ZRM-750" />
                                                                <field id="Specifier__c" uniqueid="sk-1ZRQ-768" required="false" />
                                                            </fields>
                                                        </section>
                                                        <section title="Bill To" uniqueid="sk-1ZNQ-863" collapsible="open">
                                                            <fields>
                                                                <field id="Bill_To_Address__c" uniqueid="sk-1ZPl-344" />
                                                                <field id="Bill_To_City__c" uniqueid="sk-1ZPl-345" />
                                                                <field id="Bill_To_State__c" uniqueid="sk-1ZPl-346" />
                                                                <field id="Bill_To_Zipcode__c" uniqueid="sk-1ZPl-347" />
                                                                <field id="Bill_To_Country__c" uniqueid="sk-1ZPl-348" />
                                                            </fields>
                                                        </section>
                                                        <section title="Ship To " uniqueid="sk-1ZPq-363" collapsible="open">
                                                            <fields>
                                                                <field id="Ship_To_Address__c" uniqueid="sk-1ZQ5-401" />
                                                                <field id="Ship_To_City__c" uniqueid="sk-1ZQ5-402" />
                                                                <field id="Ship_To_State__c" uniqueid="sk-1ZQ5-403" />
                                                                <field id="Ship_To_Zipcode__c" uniqueid="sk-1ZQ5-404" />
                                                                <field id="Ship_To_Country__c" uniqueid="sk-1ZQ5-405" />
                                                            </fields>
                                                        </section>
                                                    </sections>
                                                </column>
                                                <column width="33.3%" uniqueid="sk-1VFK-539">
                                                    <sections>
                                                        <section title="Dates" uniqueid="sk-1VFK-540" collapsible="no">
                                                            <fields>
                                                                <field id="Quote_Status__c" uniqueid="sk-1ZI6-490" />
                                                                <field id="CreatedDate" uniqueid="sk-1ZI6-491" />
                                                                <field id="CloseDate" uniqueid="sk-1ZI6-492" />
                                                                <field id="Must_Have_Date__c" uniqueid="sk-1ZWq-1528" />
                                                                <field id="Lead_Time__c" uniqueid="sk-1ZR4-626" />
                                                            </fields>
                                                        </section>
                                                        <section title="Money" uniqueid="sk-1ZVY-1356" collapsible="open">
                                                            <fields>
                                                                <field id="Freight_Quote__c" uniqueid="sk-1ZVj-1408" />
                                                                <field id="Freight_Quote_Notes__c" uniqueid="sk-1ZVj-1409" />
                                                            </fields>
                                                        </section>
                                                    </sections>
                                                </column>
                                                <column width="33.3%" uniqueid="sk-1ZIG-505">
                                                    <sections>
                                                        <section title="Defaults" uniqueid="sk-1ZIG-506" collapsible="no">
                                                            <fields>
                                                                <field id="Commission_Level__c" uniqueid="sk-1ZM_-813" />
                                                                <field id="Sales_Rep__c" uniqueid="sk-1ZWO-1504" />
                                                                <field id="Specifier_Sales_Rep__c" uniqueid="sk-1ZWO-1505" />
                                                            </fields>
                                                        </section>
                                                    </sections>
                                                </column>
                                            </columns>
                                        </basicfieldeditor>
                                    </components>
                                </division>
                            </divisions>
                            <styles>
                                <styleitem type="background" bgtype="none" />
                            </styles>
                            <renderconditions logictype="and">
                                <rendercondition type="blank" value="null" enclosevalueinquotes="false" field="Id" fieldmodel="Opps" sourcetype="fieldvalue" operator="!=" fieldtargetobjects="Opportunity" nosourcerowbehavior="skipandnorender" />
                            </renderconditions>
                        </grid>
                    </components>
                    <actions>
                        <action type="navigate" label="Enter Products" uniqueid="sk-1VCs-208" icon="sk-icon-arrow-right" window="self" stepid="step2">
                            <hotkeys />
                        </action>
                    </actions>
                </step>
                <step stepid="step2" steplabel="Step 2">
                    <components>
                        <skootable model="OppItem" uniqueid="sk-1z7x-364" showerrorsinline="true" mode="read" showexportbuttons="false" showsavecancel="true" showconditions="true" searchbox="true" pagesize="10" createrecords="true" buttonposition="" searchmethod="server" heading="Project items" responsive="true" allowcolumnreordering="true" alwaysresetpagination="false" hidefooter="false" hideheader="false">
                            <fields>
                                <field id="SortOrder" uniqueid="fi-1z8E-443" allowordering="true" hideable="true">
                                    <label>Line Number</label>
          &nb
(Edited)
Photo of Matt Davis

Matt Davis, Employee

  • 654 Points 500 badge 2x thumb
Have you tried doing the create row w/ default values?

Photo of Matt Davis

Matt Davis, Employee

  • 654 Points 500 badge 2x thumb
<skuidpage unsavedchangeswarning="yes" personalizationmode="server" showsidebar="true" useviewportmeta="true" showheader="true">
    <models>
        <model id="Opps" datasource="salesforce" createrowifnonefound="false" query="true" limit="1" sobject="Opportunity">
            <fields>
                <field id="Id"/>
                <field id="Amount"/>
                <field id="IsClosed"/>
                <field id="AccountId"/>
                <field id="Account.Name"/>
                <field id="CreatedDate"/>
                <field id="CloseDate"/>
                <field id="Name"/>
                <field id="Owner.Name"/>
                <field id="OwnerId"/>
            </fields>
            <conditions>
                <condition type="fieldvalue" value="" enclosevalueinquotes="true" field="Id" operator="=" novaluebehavior="deactivate" inactive="true" state="filterableoff"/>
                <condition type="param" value="id" enclosevalueinquotes="true" field="Id" operator="=" novaluebehavior="deactivate" inactive="false"/>
            </conditions>
            <actions/>
        </model>
        <model id="OppItem" datasource="salesforce" createrowifnonefound="false" query="false" limit="200" sobject="OpportunityLineItem">
            <fields>
                <field id="SortOrder"/>
                <field id="Id"/>
                <field id="Name"/>
                <field id="ProductCode"/>
                <field id="Product2Id"/>
                <field id="Product2.Name"/>
                <field id="UnitPrice"/>
                <field id="Quantity"/>
                <field id="NewField" uionly="true" displaytype="TEXT" label="new field"/>
                <field id="TotalPrice"/>
                <field id="PricebookEntryId"/>
                <field id="PricebookEntry.Name"/>
            </fields>
            <conditions>
                <condition type="param" value="id" enclosevalueinquotes="true" field="OpportunityId" operator="=" fieldtargetobjects="Opportunity" mergefield="Id" novaluebehavior="deactivate"/>
                <condition type="fieldvalue" name="Product2Id" value="{{Id}}" enclosevalueinquotes="true" field="Product2.Id" fieldtargetobjects="Product2" inactive="true" state="filterableoff"/>
            </conditions>
            <actions/>
        </model>
        <model id="Products" datasource="salesforce" createrowifnonefound="false" query="true" limit="200" sobject="Product2">
            <fields>
                <field id="ProductCode"/>
                <field id="Description"/>
                <field id="Name"/>
                <field id="AddQty" label="Quantity " scale="2" displaytype="DOUBLE" defaultvaluetype="fieldvalue" ogdisplaytype="TEXT" required="true" defaultValue="1" precision="9" uionly="true"/>
                <field id="Id"/>
            </fields>
            <conditions/>
            <actions/>
        </model>
    </models>
    <components>
        <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="Products" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-2Hek-343">
            <fields>
                <field id="ProductCode" uniqueid="fi-2Hek-344"/>
                <field id="Description" uniqueid="fi-2Hek-345"/>
                <field id="Name" uniqueid="fi-2Hek-346"/>
                <field id="AddQty" uniqueid="fi-2Hek-347"/>
                <field id="Id" uniqueid="fi-2Hek-348"/>
            </fields>
            <rowactions>
                <action type="edit"/>
                <action type="delete"/>
                <action type="multi" label="Run multiple actions" icon="sk-icon-magic">
                    <actions>
                        <action type="blockUI" message="Adding Product" timeout="5000"/>
                        <action type="createRow" model="OppItem" defaultmodefornewitems="edit" appendorprepend="prepend" affectedrows="context">
                            <defaults>
                                <default type="fieldvalue" field="Product2Id" fieldtargetobjects="Product2" enclosevalueinquotes="true" value="{{Id}}"/>
                            </defaults>
                        </action>
                        <action type="updateRow" model="OppItem" value="11" enclosevalueinquotes="false" field="Quantity" fieldmodel="OppItem" affectedrows="context"/>
                        <action type="updateRow" value="N/A" enclosevalueinquotes="true" field="NewField" fieldmodel="OppItem" affectedrows="context"/>
                        <action type="unblockUI"/>
                    </actions>
                </action>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="massupdate"/>
                <action type="massdelete"/>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
        </skootable>
        <buttonset uniqueid="sk-2GxM-298">
            <buttons>
                <button type="multi" label="Add" uniqueid="sk-2GxN-312">
                    <actions>
                        <action type="blockUI" message="Adding Product" timeout="5000"/>
                        <action type="createRow" model="OppItem" defaultmodefornewitems="edit" appendorprepend="prepend" affectedrows="context"/>
                        <action type="updateRow" model="OppItem" value="11" enclosevalueinquotes="false" field="Quantity" fieldmodel="OppItem" affectedrows="context"/>
                        <action type="updateRow" value="{{$Model.Products.data.0.Id}}" enclosevalueinquotes="true" field="Product2Id" fieldmodel="OppItem" fieldtargetobjects="Product2" affectedrows="context"/>
                        <action type="updateRow" value="N/A" enclosevalueinquotes="true" field="NewField" fieldmodel="OppItem" affectedrows="context"/>
                        <action type="unblockUI"/>
                    </actions>
                </button>
            </buttons>
        </buttonset>
        <skootable showconditions="true" showsavecancel="true" showerrorsinline="true" searchmethod="server" searchbox="true" showexportbuttons="false" hideheader="false" hidefooter="false" pagesize="10" alwaysresetpagination="false" createrecords="true" model="OppItem" buttonposition="" mode="read" allowcolumnreordering="true" responsive="true" uniqueid="sk-2H33-511">
            <fields>
                <field id="SortOrder" uniqueid="fi-2H33-512"/>
                <field id="Id" uniqueid="fi-2H33-513"/>
                <field id="Name" uniqueid="fi-2H33-514"/>
                <field id="ProductCode" uniqueid="fi-2H33-515"/>
                <field id="Product2Id" uniqueid="fi-2H33-516"/>
                <field id="Product2.Name" uniqueid="fi-2H33-517"/>
                <field id="UnitPrice" uniqueid="fi-2H33-518"/>
                <field id="Quantity" uniqueid="fi-2H33-519"/>
                <field id="NewField" uniqueid="fi-2H33-520"/>
                <field id="TotalPrice" hideable="true" uniqueid="fi-2Hgo-304"/>
                <field id="PricebookEntryId" hideable="true" uniqueid="fi-2HhA-348"/>
            </fields>
            <rowactions>
                <action type="edit"/>
                <action type="delete"/>
            </rowactions>
            <massactions usefirstitemasdefault="true">
                <action type="massupdate"/>
                <action type="massdelete"/>
            </massactions>
            <views>
                <view type="standard"/>
            </views>
        </skootable>
    </components>
    <resources>
        <labels/>
        <javascript/>
        <css/>
        <actionsequences uniqueid="sk-2Bx3-241"/>
    </resources>
    <styles>
        <styleitem type="background" bgtype="none"/>
    </styles>
</skuidpage>

Photo of Matt Davis

Matt Davis, Employee

  • 654 Points 500 badge 2x thumb
I believe this one works for me, although I initiate it through clicking on a row action icon instead. 
Photo of Ambrose Alward

Ambrose Alward

  • 300 Points 250 badge 2x thumb
D'oh  I had no clue you could do that....   Thank you all, that's a Ton simpler then how I was trying to do it!
Photo of Matt Davis

Matt Davis, Employee

  • 654 Points 500 badge 2x thumb
No problem, and yeah it's one of those things you kinda have to know is there. Noticing there is an extra button when you select the action isn't anyone's first instinct haha