How to add custom method before saving like if that method will succeed then call the save if error then show some error message in recordlistview saving in cell

How to add custom method before saving like if that method will succeed then call the save if error then show some error message in recordlistview saving in cell

Parents Reply
  • ({
    extendsFrom: 'RecordlistView',
    initialize: function (options) {
    this._super('initialize', [options]);
    this.model.addValidationTask('check_products', _.bind(this.checkProducts, this));
    },

    checkProducts: function(fields, errors, callback) {
    console.log('triggered checkProducts')
    console.log('checkProducts', Object.values(this.toggledModels)?.[0])

    callback(null, fields, errors);
    },

    })



    this is how i add the addValidationTask in recordlistview but it seem checkProducts are not loggging

Children
  • Hello  , 

    Thank you for sharing this code snippet!

    Can you confirm if this is part of the Products (QLI) module?
    If not, which module does it belong to?

    Could you also clarify the path of your custom .js file?

    It would be very helpful if you could share a screenshot of the specific location where you want to add this validation. This will help ensure that extending the RecordlistView is the correct approach.

    Lastly, could you share more details about the validation you want to implement?

    I’m curious if a Dependency Action could achieve the same result.
    If yes, this might work across all views, offering a simpler and more flexible solution.

    Looking forward to your response!

    Cheers, 

    André