Put custom graph view in account detail view

Hello Everyone

I need help. I want to put graph into account detail page.

Is it possible to add custom view into account detail ?

Yes, it’s possible to add a View to Accounts.

Now, wanting to create a section on the Account’s detail view specifically for a graph I would suggest:

  1. Create a non-DB field and place it on the Detail view
  2. Insert javascript file (via detailviewdefs) to replace this field with your graph and any other rendering functionality.
1 Like

Can you please tell me which type of Graph you want to display on an Account Detail Page like Pie Chart, Bar Chart, etc. with what kind of Information? Do you want to generate charts for specific data of the Account Record?
Also for the Custom View for Account Detail, Do you have a specific Layout Design?

1 Like

Thank you for your valuable response. Graph is working on account page

@sid1 Thanks for the update.

Let me know if you need any other help with anything.

i will let you know if any need Thank you.

Hi! I am new to SuiteCRM
How do I:

  1. add a non-DB field
  2. How to I replace it
  • Zet

It would be a combination of a few tutorials (having found a complete one specific to your request).

  1. Create a new field in extension framework.
    (this is was the most simplest tutorial I could find How do you manage your customer?: [sugarcrm] Add fields non-db into search advance Follow up to and complete Step 3. (Repair an Rebuild.) You should be able to see a new custom field in Studio.

  2. Add a javascript file to the viewdefs Metadata :: SuiteCRM Documentation
    The javascript file would find the new custom field and replace the element with whatever you wanted.

My assumption is you have some knowledge of javascript/php to position it correctly etc.

Thank you for your reply! Would it be possible to display a pie chart this way? I was planning on making a non-db field and using that field to display a pie chart in a detailsview(e.g. A pie chart that groups an opportunities stage_level in the Account detailsView that is related to it). Is this doable or should I be using a different method?

Is the pie chart rendered by the SuiteCRM reports? Or is this pie chart created via another library? Do you want the chart to be static with pre-defined parameters (grouping of the account’s opportunities stage levels?)

If it was using the existing SuiteCRM I would create a non-db function field (check out how to make a function field here), then create a function that would pull in an already created report which includes a pie chart.
Again, this is me thinking on top of my head but you could either look at how the Chart dashlet’s work and call the relevant function there with the parameters of the account_id or look directly at AOR reports function to call the appropriate method the output of the chart e.g

Yes. that is exactly it. A static chart of an opportunity’s stage level that is related to an account. Rendering it using another isn’t needed so I assume I would use the SuiteCRM reports for that?

So far, I have only been able to add a non-db field inside the extended vardefs. It actually took me some time to figure that step out since I didn’t know a field could be of type function and so I was using a function attribute instead inside of the custom field.

My problem now is rendering the Pie chart. Would there be a tutorial for something like that? I don’t think I would need a dashlet for that but something like how charts are displayed in the reports module. Should I just extend something? How do I target the custom non-db field and render the chart there? Sorry if I have so many questions. I am just very new to CRM’s in general

Completed this tutorial. I suspect it’s what you wanted. If not let me know and I can adjust.

1 Like

Hi, thank you for the reply again! I followed the tutorial and here are my results:

  1. Followed all steps but on step 10, after saving, no chart was shown. However, it shows in the Accounts detail view! (Or did you just manually inputted the id perhaps?).





  2. For this line: “$aor_Report->retrieve(‘1a992459-15d4-eef3-e370-625e905e9dcb’)” , Is there any way to put the pre-defined id of the report without having to copy the id from the database?

Other than that, it works amazingly samus!

1 Like
  1. Yes, the Report I created wasn’t for a particular Account but allows you to specific any account on the system. You wouldn’t get any results on the Report itself unless you inputted the ID of an account manually.

It works on the Accounts because we are inserting the Account ID automatically. :slight_smile:

  1. Setting the ID is the easiest way to be honest. You could try and make it configurable, giving it a fancy UI but honestly that is a lot of work if you are only going to be using 1 report. You don’t need to copy the ID from the database though, you can navigate to the Report via the application and look at the URL. It will have something like:
index.php?module=AOR_Reports&action=DetailView&record=8d77a8bb-5bcf-b98c-e4a1-625fc6bef17b

The record= is the ID of the report. That is a quick way to get the ID of a record.

1 Like