Announcement

Collapse
No announcement yet.

Error in actionRemoveRelated in client\src\views\modals\related-list.js

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error in actionRemoveRelated in client\src\views\modals\related-list.js

    When you view a Related List, by default it only shows the first five members. You can click the three dots and it will show more members in the side panel on the right.

    In the sidebar, you can use the dropdown menu to the right of each member and choose 'Remove' to remove it from the related list.

    If you try to remove an item which is not also in the truncated list in the main panel, an error is thrown.




    Here we are using a Related List for a custom mailing list entity, but the error is in the default behaviour in client\src\views\modals\related-list.js, not our customisations:

    Click image for larger version

Name:	image.png
Views:	292
Size:	125.6 KB
ID:	85633Click image for larger version

Name:	image.png
Views:	157
Size:	61.6 KB
ID:	85635

    We have found we can fix the error by changing actionRemoveRelated to:
    Code:
    actionRemoveRelated: function (data) {
    var id = data.id;
    
    this.confirm({
    message: this.translate('removeRecordConfirmation', 'messages'),
    confirmText: this.translate('Remove'),
    }, () => {
    this.notify('Removing...');
    
    Espo.Ajax.deleteRequest(this.collection.entityType +"/"+id).then(() => {
    this.notify('Removed', 'success');
    
    this.collection.fetch();
    this.model.trigger('after:unrelate');
    this.model.trigger('after:unrelate:' + this.link);
    });
    });
    },
    But we are unsure if this is the 'correct' way to fix things.

    EspoCRM version: 6.0.9, but we have tested with 7.2.7 and the error still occurs.
    PHP version: 7.3, but we have tested with 7.4 and the error still occurs​
    Attached Files

  • #2
    Thanks for reporting. Fix: https://github.com/espocrm/espocrm/c...b22cc8ffa569ab

    Comment

    Working...
    X