Filter a Link field by foreign variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #16
    don't use uppercase in views
    Does Testbase entity have account link field?

    Comment

    • Etienne
      Junior Member
      • Aug 2018
      • 27

      #17
      Hello Tanya,

      thank you for your help.

      All uppercase are change now.
      i change in :
      \custom\Espo\Custom\Resources\metadata\entityDefs\ Opportunity.json
      {
      "fields": {
      "testbases": {
      "type": "linkMultiple",
      "view": "custom:views/opportunity/fields/testbase", XXX change here
      "layoutDetailDisabled": false,
      "layoutMassUpdateDisabled": false,
      "importDisabled": false,
      "noLoad": false,
      "isCustom": true
      }
      },
      "links": {
      "testbases": {
      "type": "hasMany",
      "relationName": "testbaseOpportunity",
      "foreign": "opportunities",
      "entity": "testbase", XXX change here
      "audited": false,
      "isCustom": true
      }
      }
      }


      and

      Espo.define('custom:views/opportunity/fields/testbase', 'views/fields/link-multiple-with-role', function (Dep) { XXX change here

      return Dep.extend({

      getSelectFilters: function () {
      if (this.model.get('accountId')) {
      return {
      'account': {
      type: 'equals',
      field: 'accountId',
      value: this.model.get('accountId'),
      valueName: this.model.get('accountName'),
      }
      };
      }
      },

      getCreateAttributes: function () {
      if (this.model.get('accountId')) {
      return {
      accountId: this.model.get('accountId'),
      accountName: this.model.get('accountName')
      }
      }
      }

      });

      });


      and i change the name of file : from Testbase.js to testbase.js

      The testbase entity has a account multi-link field.

      I have the same problem with change uppercase in views.

      have you a idea ?

      thank you.
      Etienne

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #18
        in getSelectFilters you use parameters as for link field used
        EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.


        but you need as for link-multiple

        Comment

        • Etienne
          Junior Member
          • Aug 2018
          • 27

          #19
          thank you.
          I try this today.

          Etienne

          Comment

          Working...