I have a detail that opens a ModalBox when pressing the plus button.
When creating a new object record, Im not able to save the chosen values from the ModalBox to the detail... However, when saving then editing this record I can save the selected values normally. How can I fix this issue?
Note: It might be because of the ParentId of the ModalBox.. When adding a new record the ParentId is not set so the selected values will not be saved. When Editing the record the ParentId is set normally. If so, How to handle the parentId issue?
Like
Dear Mohammad,
Based on your description and screenshot you haven't saved the parent record prior choosing detail records. This is giving you an error. The detail records should be written to the database with Id of the parent record (basically indicating that they belong to a particular record). Since you haven't saved the parent record, there is no Id yet.
Please save the record on the page, the data will be stored to database and given a uniqueidentifier. Afterwards, the detail records can be chosen and will be linked to the existing record.
Regards,
Anastasia
Anastasia Botezat,
Thank you for your reply it was really beneficial. However, how can I save the parent record directly prior to saving the detail records?
I want to save the parent record instead of the comment
onSelectButtonClick: function() {
// Saving Parent Record
var grid = this.getCurrentGrid();
var selectedRows = Ext.Array.filter(grid.rows, function(item) {
return Ext.Array.contains(grid.selectedRows, item.Id);
}, this);
var batchQuery = this.Ext.create("Terrasoft.BatchQuery");
for (var i = 0; i < selectedRows.length; i++) {
batchQuery.add(this.createRowInsertQuery(selectedRows[i]));
}
batchQuery.execute(this.onContactInsert, this);
},
An option is to send the page reference of the parent record to the modalbox. But im also not sure how to do so
Thank you in advance
Mohammad Yahfoufi,
Please debug how works the "LookupMultiAddMixin" module described in the article by the link below.
https://academy.bpmonline.com/documents/technic-sdk/7-13/adding-multiple-records-detail