Skip to main content

I have a snippet that creates new rows through a mass action. Since upgrading to 11.1.1, the snippet creates the first record twice and I cannot seem to find a way around it. This was happening with two models on the snippet so I commented out one and added it separately as it’s own action but we need to have rows that are created from selected table items. Is this a bug or am I doing something incorrectly?

Snippet below:


var params = argumentst0],<br> $ = skuid.$;<br><br>var table = skuid.$C('sk-3-w0AD-637');<br>var list = table.element.data('object').list;&nbsp;<br>var selectedItems = list.getSelectedItems();<br>var newQuote = skuid.$M('NewQuote');<br>var quoteLines = skuid.$M('NewQuoteLineItems');<br><br>console.log(selectedItems);<br><br>//create a new quote<br>//newQuote.createRow();<br><br><br><br>$.each(selectedItems, function(){<br>&nbsp; &nbsp;var row = this.row;<br>&nbsp; createNewRows(row.Id, row.Product2Id, row.Quantity, row.UnitPrice, row.ServiceDate, row.PricebookEntryId);<br>});<br><br><br><br>function createNewRows(id, product, quantity, salesprice, startdate, pricebookentry){<br>&nbsp; &nbsp; quoteLines.createRow({<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; additionalConditions:s<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {field:'QuoteId', value: newQuote.datat0].Id},<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {field:'Product2Id', value: product},<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {field:'Quantity', value: quantity},<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {field:'UnitPrice', value: salesprice},<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {field:'ServiceDate', value: startdate},<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {field:'PricebookEntryId', value: pricebookentry},<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {field:'OpportunityLineItemId', value: id}<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ], editModeForNewItems: true,<br>&nbsp; &nbsp; doAppend: true<br>});<br>}<br><br>console.log(quoteLines);<br><br><br><br>var wizard = $('.nx-wizard').data('object');&nbsp;<br>var currentStep = wizard.stepspwizard.currentstep];<br>currentStep.navigate('quoteEdit');






If anyone else is facing this issue, as a temporary workaround I am abandoning the first row at the end of my snippet:


quoteLines.abandonRow(quoteLines.getFirstRow() );<br>

Reply