Show all Opportunities in the Accounts List and Detail View

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thimm
    Junior Member
    • Mar 2025
    • 2

    Show all Opportunities in the Accounts List and Detail View

    Hi everyone,


    I’m trying to configure EspoCRM to show all opportunities linked to an account in both the list view and the detail view of the account. Right now, I can see opportunities under the Opportunities and on the details view I can also see the linked account, but I cannot seem to make it work into the other direction.

    Is there a way to achieve this? If anyone has done this before, I’d appreciate some guidance.
    Thanks in advance!
  • jeffreysgrossman
    Member
    • Jan 2025
    • 65

    #2
    If I am understanding you correctly, you are asking how to get all the opportunities that are linked to an account to show up under that account? If that is right you go to entity manager and load up the Account Entity. Go to layouts and choose the bottom panel section. Add Opportunity to that section. That will have a new section on the detail view of the Accounts show all the linked Opportunities in a bottom section. You can control what columns show up by going to the opportunity entity manager and set the fields on the List (For Accounts) section..

    On the Accounts Entity Manger | Layouts section
    Click image for larger version

Name:	image.png
Views:	50
Size:	85.8 KB
ID:	116048

    On the Opportunity Layouts..Click image for larger version

Name:	image.png
Views:	39
Size:	165.6 KB
ID:	116049
    I think that is what your asking about.. But do let everyone know if not..

    Comment

    • thimm
      Junior Member
      • Mar 2025
      • 2

      #3
      Hi Jeffrey,
      Thanks for your help. This is already very helpful, however what I need is slightly different. With the approach that you show it is still not possible to see at a glance if the account has an opportunity or not (I'm also not able to filter based on that either)

      In short, I’m trying to see all possible opportunities linked to a single account, so that I can

      1. See all opportunities whenever I open an account (this is possible now)
      2. In the list view, be able to filter down to accounts that don’t currently have an opportunity.
      3. Have a clear indication, within the list view of accounts, whether an account has an opportunity or not.

      As you can see in the screenshot below, the field opportunities is not available for the list view, but only for the Bottom Panels. I imagine something like a list of opportunities, or a True or False in case there is at least one opportunity for the account


      Thanks so much for your help





      Click image for larger version

Name:	image.png
Views:	36
Size:	315.3 KB
ID:	116086


      Attached Files

      Comment

      • jeffreysgrossman
        Member
        • Jan 2025
        • 65

        #4
        Hi thimm I think you have the answer there. You can create a field in the Accounts Entity that could be a boleen field. Call it "Has Opportunities" or anything like that you want. Then set a script in the formula section of the entity manager to run and update if it has an opportunity attached. You can also have a field in the Accounts entity that is say number of opportunities. Then have a script to update that field with the number of related opportunities. Those custom fields you have can then be put on the list view of the accounts and will show columns for Has Opportunity "yes" and a column that would show Number of Opportunities and show say 4 or 0 and the boleen field is set to no.

        API Before-Save script - EspoCRM Documentation
        Functions - EspoCRM Documentation

        That should help you get all that set up and working. Feel free to ask more questions if that does not make sense or you need more guidance.

        Example Script would be:
        hasOpportunity = entity\isRelated('Opportunity', );
        numberOfOpportunities = entity\countRelated('opportunity', );

        Put into the formula section of the Accounts Entity Manager.
        Last edited by jeffreysgrossman; 03-21-2025, 03:33 AM.

        Comment


        • yuri
          yuri commented
          Editing a comment
          I'd recommend to use the regular Before-Save script, not API Before-Save. That will allow to run the formula for all existing accounts by selecting all results on the list view.
      • yuri
        Member
        • Mar 2014
        • 8795

        #5
        It's also possible to utilize the Report Filters feature from Advanced Pack. A filter can display accounts with or without opportunities.

        It's also possible to add a custom field in metadata that will allow to add the Opportunities filter in the Accounts list view. But it requires some effort to do it properly.
        If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

        Comment

        Working...