How to disable back end field validation to avoid the "Field Validation" error

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • telecastg
    commented on 's reply
    Is that the red dot item ? How did you find it ?

    I checked shalmaxb posted code with Notepad++ and could not reproduce the error

    I also checked on my installation and I have an entityDefs file like this, working without any problems

    "startingDate": {
    "type": "datetime",
    "validationList": [],
    "mandatoryValidationList": []
    },
    "endingDate": {
    "type": "datetime",
    "validationList": [],
    "mandatoryValidationList": []
    },
    "firstExecutionDate": {
    "type": "datetime",
    "validationList": [],
    "mandatoryValidationList": []
    },
    Last edited by telecastg; 03-12-2023, 05:11 AM.

  • item
    replied
    special caractere at the end !

    Leave a comment:


  • shalmaxb
    replied
    Hi,
    thank you for your offer telecastg.
    Here is the field, that needs to bypass the validation:

    Code:
    "shippingCost": {
    "tooltip": true,
    "default": 10,
    "onlyDefaultCurrency": false,
    "conversionDisabled": false,
    "validationList": [],
    "mandatoryValidationList": []​
    },​
    but still on rebuild I get a json code error, which is not there, when I rebuild without the two lines. Version espoCRM is now 7.3.4

    Leave a comment:


  • telecastg
    commented on 's reply
    If it doesn't work, try checking the entitDefs custom script with your development platform/ editor to see if it detects any json structure errors. I use Eclipse from Apache and it will highlight json structure errors.


    Another option (just for you friend, because you always help everyone), post the code from 'custom/Espo/Custom/Resources/metadata/entityDefs/Quote.json' and I will take a look too.

  • shalmaxb
    commented on 's reply
    Thank you, then that is, why it does not work here, my client uses 7.3.2. Will recommend to him to update and then try again.

  • rabii
    commented on 's reply
    i think since version 7.3.3

  • shalmaxb
    commented on 's reply
    Since which version does this work?

  • rabii
    commented on 's reply
    me too i have tried it and it worked. definitely some issue with json file.

  • shalmaxb
    commented on 's reply
    The field is a currency field (built in into sales extension) and is not in use from my client. But it seems, this code does not work for that field. I do not see any jsn error, though it is thrown.
    This is the error in the log file:
    [2023-03-10 07:03:01] ERROR: Uncaught Exception JsonException: "JSON syntax error in 'custom/Espo/Custom/Resources/metadata/entityDefs/Quote.json'." at /var/www/espocrm/application/Espo/Core/Utils/File/Unifier.php line 250 {"exception":"[object] (JsonException(code: 0): JSON syntax error in 'custom/Espo/Custom/Resources/metadata/entityDefs/Quote.json'. at /var/www/espocrm/application/Espo/Core/Utils/File/Unifier.php:250)"} []

  • telecastg
    commented on 's reply
    hello shalmaxb I tried with just the brackets and it worked fine, maybe it has something to do with the entityDefs json structure ?

  • shalmaxb
    replied
    telecastg
    I tried to use this code for one field, but I get a json error (wrong code). It might be because of the [ ]. Has there to be any value? Or just leaving the brackets?
    Thank you in advance.

    Leave a comment:


  • telecastg
    commented on 's reply
    You're very welcome rabii

  • rabii
    replied
    thanks for sharing.

    Leave a comment:


  • How to disable back end field validation to avoid the "Field Validation" error

    Sometimes, for whatever reason, it is preferred to bypass Espo's built in field validation rules to avoid triggering the "Field Validation Error" message and interrupting the back end program flow.

    Fortunately, this is now possible using metadata settings, so it is not necessary to do any coding to accomplish this.

    Simply add these two parameters in your custom entity entityDefs json file under the field for which you want to bypass all validations:

    Code:
    "validationList": [],
    "mandatoryValidationList": []​

    For participants that do not mind writing code, the documentation https://docs.espocrm.com/development...validationlist has information on how to define and invoke custom back end validations in case this is the preferred solution.
Working...