BelongsToMany inside Smart View

I have a belongsToMany I’m trying to query for in a smart view, but it’s complaining that no model exists.

    // user model
    User.belongsToMany(models.WorkPreferences, {
      foreignKey: 'UserID',
      otherKey: 'WorkPreferencesID',
      through: models.UserxWorkPreferences

    // work preferences
    WorkPreferences.belongsToMany(models.User, {
      foreignKey: 'WorkPreferencesID',
      otherKey: 'UserID',
      through: models.UserxWorkPreferences
    // component.js - trying to query
    get workPreferencesModel() {
      return this.args.collection.rendering.collections.find(
        item => === 'WorkPreferences'

    // in call
    const userParams = {
      filters: JSON.stringify({
        aggregator: 'and',
        conditions: [
            field: 'UserID',
            operator: 'equal',
            value: stub['forest-User'].id
      'page[number]': 1,
      'page[size]': 50

   await'forest-WorkPreferences', userParams)
// error 
Uncaught (in promise) Error: No model was found for 'forest-work-preferences' and no schema handles the type

Yet I can see the relationship set on the User record:

Appreciate any insights. Thanks!

Hello @David_Panzarella,

Thanks for this feedback.

Are you able to browse correctly work preferences of users?


Hello @David_Panzarella

Could you try to use the singular form when querying the store? eg:

await'forest-work-preference', userParams)

Thank you

1 Like

Thanks guys! @anon79585656 super close! All I had to do was just the singular version for join:

await'forest-UserxWorkPreference', userParams)

Thanks for getting me there!

On a different note, is there any way to reference a file from within a Smart View? Like a utility file that is in my local admin folder? I think not, but thought I’d ask. It’d be a lot easier to have some of my logic in a utility file that I could use in multiple Smart Views.

Thanks again!