AnsweredAssumed Answered

sugarcrm: Uncaught TypeError: Cannot read property 'find' of null

Question asked by Aravind Kumar on Jan 17, 2017
Latest reply on Mar 2, 2017 by EL HADJI DEM

I am working with sugarcrm record view. I am creating a popup drawer and opening another module ex: notes inside - cases modules.

I am successful in creating the popup and duing the process I am facing some issue and due tot hat the functionaity doisent work as expected.

Following is the error which i am receiving.

The error in sugar_grp7.min.js

I tried to debug the error using breakpoint. Seems that the model is not set, cant figure out where the actual problem is any help. Thanks,

Following is the code.

_render: function() {
console.log('_render');
console.log(this);
this.clearErrorDecoration();
this._processHelp();
_fieldProto._render.call(this);
if (this._previousAction) {
this._addViewClass(this._previousAction);
}
this._addViewClass(this.action);
if (!_.isEmpty(this._errors)) {
if (this.action === 'edit') {
this.decorateError(this._errors);
}
}
if (this.def.required) {
this.clearRequiredLabel();
if ((this.action === 'edit' || -1 !== _.indexOf(['edit', 'list-edit'], this.tplName)) && this._shouldRenderRequiredPlaceholder()) {
this.decorateRequired();
}
}
if (this.def.help) {
this.clearHelper();
if (this.action === 'edit' || -1 !== _.indexOf(['edit', 'list-edit'], this.tplName)) {
this.decorateHelper();
}
}
if ($.fn.placeholder) {
var $input = this.$('input');
_.each($input, function(element) {
var $element = $(element);
$element.attr('placeholder') && $element.placeholder();
});
}
},


The problem happens in this.clearErrorDecoration();

clearErrorDecoration: function() {
console.log('this.fieldTag '+this.fieldTag);
var ftag = this.fieldTag || '',
$ftag = this.$(ftag)|| '';


The error happens in ftag = this.fieldTag || ''

If you see this

> child {cid: "view674", model: null, options: Object, $el: null, el:null…}

Its null.

but all other flow shows

> child {cid: "view676", model: child, options: Object, $el: init[1],el: span…}

Is the iss in this code?

app.events.on("app:init", function() {
var _fieldProto = _.clone(app.view.Field.prototype);
_.extend(app.view.Field.prototype, {
hideHelp: false,
exclamationMarkTemplate: Handlebars.compile('<span class="error-tooltip add-on" data-container="body" rel="tooltip" title="{{arrayJoin this ", "}}"><i class="fa fa-exclamation-circle"></i></span>'),
handleValidationError: function(errors) {
this.clearErrorDecoration();
_.defer(function(field) {

Outcomes