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!
Do you have the “Create default row if Model has none” option selected on the OppItem model?
It’s unchecked.
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?
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!
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.
Of course
{{Name}}
{{Path_Stage__c}}
SAP Quote Number
Project Name
Owner
Customer
 
I think this comment got cutoff early by a line/character limit. Any chance you can post the second half?
For simplicity there is the relevant page
Line Number
Ferrule
Finish
Kick Plate
Metal Finish
Products
Can you try moving the create row to be before the update field actions?
In the xml it looks like it tries to update two fields, then creates the row, then updates the field.
When I put the create row first all I get on each button click is a blank line
Have you tried doing the create row w/ default values?
<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>
I believe this one works for me, although I initiate it through clicking on a row action icon instead.
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!
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
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.