function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yash JagtapYash Jagtap 

Does apex:chart work for a partner communities user?

I am using apex:chart tag on visualforce page, to display a chart to community users having a "Customer Community Login" license.

I've added the VF component on builder, enabled the respective VF page and controller class. But when I publish the changes, those changes don't reflect on the community for users.

What is the problem here? How should I resolve it?
 
Best Answer chosen by Yash Jagtap
Dushyant SonwarDushyant Sonwar
Hi Yash,

I tried with adding simple vf chart and i was able to add it on community.
User-added image




https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_charting_overview_simple_example.htm

Could you please try with above example? if it is working for you , then it is an issue related to FLS.



 

All Answers

Dushyant SonwarDushyant Sonwar
Yash,

It seems to be a permission issue. Type sites in sidebar , click on sites and then click on the [community name]   that you are adding the component .
User-added image


You will land on site detail page





Give permission  to page and class that you are using. Click on Edit, add the vf pages and same for Apex Classes.


User-added image
User-added image

Click on Public Access Settings

User-added image

Give permission to objects and fields that you are using.

Hope this helps!
Yash JagtapYash Jagtap

Thanks, Dushyant for the quick replay,
I am able to see the visualforce component on the community, also the data which I am fetching from the controller is getting displayed but the chart is not visible.

What I am able to see right now
User-added image

What I expect (I am able to see this in community experience builder)
User-added image

Dushyant SonwarDushyant Sonwar
Hi Yash,

I tried with adding simple vf chart and i was able to add it on community.
User-added image




https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_charting_overview_simple_example.htm

Could you please try with above example? if it is working for you , then it is an issue related to FLS.



 
This was selected as the best answer
Yash JagtapYash Jagtap
Thank you, Dushyant.
I tried using a simple chart you mentioned and it is working well, so I checked out FLS which I fixed after you suggested.
Also, I enabled Apex class at the user profile level but not at the communities' profile level[from sites settings]. Then I enabled the class and now it is working.
Thank you for your quick responses and help.