I am trying to adding multiple line items for an opportunity record. I click save once.
However the order of the saved line items do not match the order in which in created those records during inline record creation by clicking the green plus icon.
Please see the before save and after save images. How do i maintain the sequence in which the records were added? Order by CreatedDate DESC is not helping
I replicated this issue in my Skuid pages and also found that I experienced the same reordering issue when mass importing CSV records into Salesforce. The Salesforce database appears to batch process records in parallel, rather than serially, which means that any mass create action will result in records that appear out of order in an unordered and unsorted table.
I found that sorting by CreatedDate and LastModifiedDate generate the same issue.
- I would suggest ordering by the Line Item Description field name.
I think you already know where to change that setting because you mentioned that you had attempted to order by CreatedDate DESC. This next part is for anyone else who searches for a similar issue:
You can set that by selecting your Model in the Model tab and clicking the Advanced button. Then you can change “Fields to Order Records by” to the field name for Line Item Description in ascending order. If the field name is LineItemDescription__c, then you would input that field name with a space and then ASC (for ascending) or DESC (for descending).
- If ordering by Line Item is not helpful, then the next best thing might be to create a new custom field in your Opportunities object that holds a record order number. After you add this field to your Skuid table, you can number the items according to your needs and can set the table to sort by this number. This does mean that you have an extra field to input when creating new records, so it is not an elegant solution.
Sorry that there is not a simple answer to this one. Let me know if you there is anything else we can do.
-Josh
Josh, Given the limitations i think a custom field holding the order number might be the next best solution. However is there a snippet you can provide that will allow me to auto populate + auto increment that field everytime a new record is created via click of the Create New Row button or during a clone operation.
I tried to implement something…but its not working…Even though it is able to create the sequence numbers. it is not persisting it into salesforce.
var field = argumentse0],
value = argumentse1];
$ = skuid.$;
if (field.mode == ‘read’) {
skuid.ui.fieldRenderers.TEXT.read(field,value);
}else{
$(document).ready(function() {
setTimeout(function() {
var row = field.elementa0].parentElement.parentElement.rowIndex;
skuid.ui.fieldRenderers.TEXT.edit(field,field.elementT0].parentElement.parentElement.rowIndex);
}, 1000);
});
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.