Announcement

Collapse
No announcement yet.

Unexpected token Error when trying to create custom entity

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

  • Unexpected token Error when trying to create custom entity

    Hello friends,

    I have a strange error. I do not see this error on my development server but I do see it on my production server. Same Espo version on both servers 7.4.5. PHP version is slightly different
    production php version: (8.0.30)
    development php version: (8.2.5)


    I get the following error when visiting:

    https://{espoURL}/#{MyCustomEntity}/create

    Other custom entities I've created don't give any error when visiting the 'create' url. It is just this one. How should I go about debugging this?

    espo.min.js:2
    [Error] Unhandled Promise Rejection: SyntaxError: Unexpected token '<'
    Function (espo.min.js:6)
    _execute (espo.js:277)
    _handleResponse (espo.js:738)
    (anonymous function) (espo.js:606)
    enqueueJob
    then
    (anonymous function) (espo.js:605)​

  • #2
    UPDATE

    It turns out the reason for this error was MyCustomEntity had a custom view defined for the field "phoneNumber"

    This view was causing the error but I still don't know why. All the custom view did was hide the addPhoneNumber, optOut, and invalid buttons.

    The view extended a view from an extension I use by Eblasoft called ebla-mask-field.

    Here is the view file:


    Code:
    define('custom:views/radiation-safety-officer/fields/phone-number', 'ebla-mask-field:views/fields/phone', function (Dep) {
    
    return Dep.extend({
    
    setup: function () {
    Dep.prototype.setup.call(this);
    //console.log("custom:views/radiation-safety-officer/fields/phone-number model = ", this.model);
    },
    
    afterRender: function () {
    Dep.prototype.afterRender.call(this);
    
    if ( this.isEditMode() ) {
    this.$el.find('[data-action="addPhoneNumber"]').addClass("hidden");
    this.$el.find('button[data-property-type="optOut"]').addClass('hidden');
    this.$el.find('button[data-property-type="invalid"]').addClass('hidden');
    
    }
    }
    
    });
    });
    ​



    Comment


    • #3
      Hello,

      You can replace the view of mask extension with the espo view, the mask extension not tested on espo 8 yet.
      CEO & Founder of Eblasoft.
      Professional EspoCRM development & extensions.

      Comment

      Working...
      X