Announcement

Collapse
No announcement yet.

Filter contacts field of call entity based on account

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

  • Filter contacts field of call entity based on account

    Hi all,

    i have created 3 entities : Clients - Services - Projects

    - Client Has Many Projects
    - Client Has Many Services
    - Projects Has Many Services

    I would want to create new project and once i choose the client for this projects then when selecting services for the projects i want to get only services of the client select for this projects , just like the existing relation between call - contacts and account. In the call entity when creating new call for a specific account then in the contacts field you can choose only contacts that belong to this current account. please see attached screenshot.

    Click image for larger version

Name:	Contacts filtered based on accountId.jpg
Views:	571
Size:	57.0 KB
ID:	50308

    i hope someone can help.

    Many thanks
    Attached Files

  • #2
    Anyone Help Please

    Comment


    • #3
      Hi rabii ,

      You will have to write custom code for this feature.

      Check this:
      https://github.com/espocrm/espocrm/b...ds/contacts.js


      You need: getSelectFilters

      You need override this function for your entity in custom


      Write a javascript file in client/custom/src/views/project/fields/services.js with below code

      Code:
      Espo.define('custom:views/project/fields/services', 'views/fields/link-multiple', function (Dep) {
        return Dep.extend({
          getSelectFilters: function () {
              // Figure out the logic yourself
          }

      Then you need to update your custom/Espo/Custom/Resources/metadata/entityDefs/Project.json

      Code:
      {
        "fields": {
          "services": {
             "type": "linkMultiple",
             "layoutMassUpdateDisabled": true,
             "view": "custom:views/project/fields/services"
          }
        }
      }
      Last edited by theBuzzyCoder; 08-09-2019, 04:04 PM.

      Comment


      • #4
        Many thanks
        this was helpful i have managed to get it done, one more thing i was thinking of can i disable the filter editing on that view, is there any property i can set to make filter not editable.

        many thanks
        Rabii

        Comment


        • theBuzzyCoder
          theBuzzyCoder commented
          Editing a comment
          I don't know. Please add yuri in your comment. He might know. Maybe you can make the search filter read-only field.
      Working...
      X