Problem - countConditional in custom module

Hi,

I created for my company a custom module with the module builder and want to display a statistic tab with calculated fields. I started with some counts on related modules (contacts, opportunities, ...) and they work just fine. Now I need related entries with specific statuses.

Creating a calculated field referencing contacts like this works:

countConditional($my_module_contacts_1,"custom_status_c",createList("termin"))

Now I tried referencing to opportunities in a specific sales stage: 

countConditional($my_module_opportunities_1,"sales_stage",createList("Lead"))

Sugar sees no error in this code, but when I try to open any object from my module I get an error stating

HTTP:404 Not Found.

Page does not exists or insufficient rights. Contact your Administrator.

I don't have a clue why the first works and the second doesn't .

My Company is using the Enterprise Edition 7.9.3.x

  • Wow, you're great. Logging with F12 showed the URL is generated with all fields as short URL term. It was just a coincidence it happended while referencing another module than contacts. 

    I deleted some calculated fields from my module and 

    countConditional($my_module_opportunities_1,"sales_stage",createList("Lead"))

    displays everything as promised.

    On crash parameters are:

    1. Request Method:
      GET
    2. Status Code:
      404 Not Found
    3. Remote Address:
      xxx.xxx.xxx.xxx
    4. Referrer Policy:
      no-referrer-when-downgrade

    It has to be a limit of one kind, but I don't know where it is. I tried increasing our IIS max length, looked in the php's from sugar and tried different browser (firefox should be able to resolve the URL). Is there a work around with that long link or any idea how to increase the possible size?

  • Probably some enpoint returned error 404.

    Open developer tools in the Chrome/Firefox (F12), at the developer tool go to tab network and retry. Hopefully you will see an errored end point call (red highlighted). Let us know the entire endpoint and its information (request, response).

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • What type of relationship is between opportunities and your custom module? In case of n:m countConditional will not work.

    Bests

    Björn

  • The problem is I have too many countConditional() statements. It seems sugar can't resolve it and cuts somewhere and throws a 404 error.

    The browser and the IIS can resolve a link from that length.

    The generated link (slightly modified):

    not-important-sugar-url/rest/v10/ExpressionEngine/47c9255e-a45f-11e8-9dc3-005056983c67/related?module=my_custom_campaign&fields=%5B%7B%22target%22%3A%22sum_contacts_termin_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_contacts_1%22%2C%22condition_field%22%3A%22leadgen_status_c%22%2C%22condition_expr%22%3A%22createList(%5C%22termin%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_contacts_reminder_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_contacts_1%22%2C%22condition_field%22%3A%22leadgen_status_c%22%2C%22condition_expr%22%3A%22createList(%5C%22wiedervorlage%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_contacts_missed_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_contacts_1%22%2C%22condition_field%22%3A%22leadgen_status_c%22%2C%22condition_expr%22%3A%22createList(%5C%22nicht_erreicht%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_contacts_rejected_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_contacts_1%22%2C%22condition_field%22%3A%22leadgen_status_c%22%2C%22condition_expr%22%3A%22createList(%5C%22ablehnung%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_contacts_open_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_contacts_1%22%2C%22condition_field%22%3A%22leadgen_status_c%22%2C%22condition_expr%22%3A%22createList(%5C%22offen%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_contacts_closed_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_contacts_1%22%2C%22condition_field%22%3A%22leadgen_status_c%22%2C%22condition_expr%22%3A%22createList(%5C%22beendet%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_opportunities_lead_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_opportunities_1%22%2C%22condition_field%22%3A%22sales_stage%22%2C%22condition_expr%22%3A%22createList(%5C%22Lead%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_opportunities_lead_2_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_opportunities_1%22%2C%22condition_field%22%3A%22sales_stage%22%2C%22condition_expr%22%3A%22createList(%5C%22Lead%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_opportunities_lead_3_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_opportunities_1%22%2C%22condition_field%22%3A%22sales_stage%22%2C%22condition_expr%22%3A%22createList(%5C%22Lead%5C%22)%22%7D%2C%7B%22target%22%3A%22sum_opportunities_lead_4_c%22%2C%22type%22%3A%22countConditional%22%2C%22link%22%3A%22my_custom_campaign_opportunities_1%22%2C%22condition_field%22%3A%22sales_stage%22%2C%22condition_expr%22%3A%22createList(%5C%22Lead%5C%22)%22%7D%5D

  • Develop Custom Modules using built-in tools in Zoho Recruit to address your recruitment requirements PrepaidGiftBalance

  • Average module size Used to measure the average size of the modules in the application prepaid gift balance.