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
Mahanandeesh BelagantiMahanandeesh Belaganti 

i used a standard query of approval history of salesforce

i used a standard query of approval history which gives status of approval from workbench for community ,when i am executing it as administration it is working but when i tried it in community its not working means the page is working but it is not displaying data.please tell wheather the standard query works for customer community.if works tell me how.please as soon as possible
Try the below quickly:
1. Create an apex class as "without sharing"
2. In this class keep a wrapper class that can hold the data you want to show on the community page. Keep it public
3. Now, Use this without sharing class to query the approval history and create a list of wrapper class instancess.
4. call the method in that without sharing class that can return you the data you desire.

I quickly wrote the below code for you to give clear idea. "approvalUtil" is what i am refferring to as "without sharing" class.

public without sharing approvalUtil
   public class approvalHistoryWrapper
      //Here: declare whatever fields you want to display from approval history
      public string approverName;      

   public List<approvalHistoryWrapper> getApprovalHistory()
     List<approvalHistoryWrapper> approvalHistory = new List<approvalHistoryWrapper>();
     // Query Approval History
     // Create a List of "approvalHistoryWrapper" Instances
     returnn approvalHistory;

Please try and let me know the answer.