Dynamic Logic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tinchux
    Junior Member
    • Dec 2021
    • 12

    Dynamic Logic

    Hi I configured a Dynamic Logic with two dependencies in Cases entity. It didn't work as I expected so I decided to delete it. Now I have an issue when a run Cases form for the first time Dynamic Logic is no present, but when I access the case form again I visualize dynamic logic apply.

    Of course, I rebuild system and cache but still remain ...it Seem to be cached or something. Where can I find a clue to solve it

    Regards in advance.
    Martin
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    Go to custom/Espo/Custom/Resources/metadata/clientDefs/yourEntity, maybe there is still some code referring to this dynamic logic, delete it manually. After that rebuild.

    Comment


    • tinchux
      tinchux commented
      Editing a comment
      Thank I pasted the results below
  • yuri
    Member
    • Mar 2014
    • 8440

    #3
    Would be good to reproduce this problem. Maybe need some fixing.
    If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1602

      #4
      This happens, when you have a field with dynamic logic and delete it. If you delete the dynamic logic first, everything is ok, but when you do not delete before deleting the field, the dynamic logic is kept in the ckientDefs.

      Comment

      • yuri
        Member
        • Mar 2014
        • 8440

        #5
        I could not reproduce. Dynamic logic metadata is removed upon field removal.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment


        • shalmaxb
          shalmaxb commented
          Editing a comment
          Regarding the scenario I wrote, I couldn`t reproduce as well. I guess I don`t remember one more step, which I took. But I remember, that this happened a few times to me.
          I will try to remember.
      • tinchux
        Junior Member
        • Dec 2021
        • 12

        #6
        I found this here:

        custom/Espo/Custom/Resources/metadata/clientDefs

        CasosWeb is myy Entity with the issue

        root@ESPOCRM clientDefs]# cat CasosWeb.json
        {
        "controller": "controllers/record",
        "dynamicHandler": "custom:casosweb-dynamic-handler",
        "boolFilterList": [
        "onlyMy"
        ],
        "sidePanels": {
        "detail": [
        {
        "name": "activities",
        "label": "Activities",
        "view": "crm:views/record/panels/activities",
        "aclScope": "Activities"
        },
        {
        "name": "history",
        "label": "History",
        "view": "crm:views/record/panels/history",
        "aclScope": "Activities"
        },
        {
        "name": "tasks",
        "label": "Tasks",
        "view": "crm:views/record/panels/tasks",
        "aclScope": "Task"
        }
        ]
        },
        "dynamicLogic": {
        "fields": {
        "resolucion": {
        "visible": null
        },
        "codigoDeCupon2": {
        "visible": {
        "conditionGroup": [
        {
        "type": "isNotEmpty",
        "attribute": "codigoDeCupon"
        }
        ]
        }
        },
        "montoDeResarcimiento2": {
        "visible": {
        "conditionGroup": [
        {
        "type": "isNotEmpty",
        "attribute": "montoDeResarcimiento"
        }
        ]
        }
        },
        "descripcionCupon2": {
        "visible": {
        "conditionGroup": [
        {
        "type": "isNotEmpty",
        "attribute": "descripcionCupon"
        }
        ]
        }
        },
        "descripcionResolucion": {
        "visible": null
        },
        "motivo": {
        "visible": null
        }
        },
        "options": {
        "motivo": null,
        "clasificacion": null
        }
        },
        "kanbanViewMode": false,
        "color": "#ffffff",
        "iconClass": "fas fa-address-card"


        And this is "custom:casosweb-dynamic-handler"

        let previusState = '';
        return Dep.extend({
        init: function () {
        this.controlFields();

        // invoke controlFields method every time assignedUserId gets changed
        this.recordView.listenTo(
        this.model, 'change:estado', this.controlFields.bind(this)
        );
        },

        controlFields: function () {
        let errors = [];
        console.log('Current state: ' + this.model.get('estado'))
        if(this.model.get('estado') == "Cerrado") {
        if (this.model.get('categoria') == "0") {
        errors.push("Categoria");
        }
        if (this.model.get('motivo') == "0") {
        errors.push("Motivo");
        }
        if (this.model.get('clasificacion') == "0") {
        errors.push("Clasificacion");
        }
        if (this.model.get('motivodeconsultareclamo') == "0") {
        errors.push("Motivo de Consulta");
        }
        } else {
        previusState = this.model.get('estado');
        console.log('Previus state: ' + previusState)
        }

        if(errors.length) {
        $('*[data-name="estado"] select').val(previusState);
        this.model.set("estado",previusState);
        Espo.Ui.notify(
        'Para cerrar un caso debe completar la seccion de tipificacion: ' + errors.join(' , ')
        , 'error', 10000, true);
        }
        },
        });
        });


        Comment

        Working...