AnsweredAssumed Answered

How to filter with fetch?

Question asked by spark2 on Dec 1, 2015
Latest reply on Dec 1, 2015 by spark2

EDIT: Never mind, fixed it. Is there a central and public bug tracking repository for SugarCRM? Because it would be really, really beneficial to know what bug fixes have been indentified and what haven't.

 

modules/Emails/clients/base/views/compose/compose.js

 

I found the following code as part of the SugarCRM core.  It's used for fetching notes with a specific template.id (by using filter). However, it does not work, it always returns nothing even though I am 100% certain the template exists. If I remove the filter part, I get ALL the notes in the system. I'm suspecting it's a bug in SugarCRM, but not sure. Is there any other way to achieve the same thing? Do I need to write a custom REST API (hoping to avoid that).

 

If someone could point be in the right direction that'd be great.

 

Thanks!

 

notes.fetch({

                'filter':{

                    "filter":[

                        {"parent_id":{"$equals":template.id}}

                    ]

                },

                success:_.bind(function(data) {

 

                console.log("suceess:");

                console.log(data);

                console.log(data.models);

                    if (this.disposed === true) return; //if view is already disposed, bail out

                console.log('view not disposed');

                if (!_.isEmpty(data.models)) {

                        this.insertTemplateAttachments(data.models);

                    }

                }, this),

                error: _.bind(function(error) {

                    this._showServerError(error);

                }, this)

            });

Outcomes