• swapnil kale
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 4
    Replies

I have created a community. Cloned a Profile with license "Customer Community Plus". When i login into as an customer I see all the Accounts.

I want to change this. User should see/edit only related account and contact.

Account are created by admin hence owner of record is admin.

I tried to make Account as private in "Sharing Settings" and community user was able to see only related record but was not able to edit the record. 

How should i implement this?

 

Hi,

I am attaching a csv file and following is the code

   

List<Opportunity> listCurrentShowOpportunities = [select Name,OwnerId,AccountId,StageName,Probability,TotalOpportunityQuantity,Amount,Description,CloseDate from opportunity] ;

String csvContent = 'Name,Owner Name,Owner Id,Account Name,Account Id,Stage Name,Probability,Total Opportunity Quantity,Amount,Description,Close Date'+'\n';
      
 for (Opportunity opp : listCurrentShowOpportunities){
        csvContent = csvContent + opp.Name + ',' + opp.Owner.FirstName + opp.Owner.LastName + ',' + opp.OwnerId + ',' + opp.Account.Name + ',' + opp.AccountId + ',' + opp.Show__r.Name + ',' + opp.Show__c + ',' + opp.StageName + ',' + opp.Probability + ',' + opp.Item__c + ',' + opp.Item_Type__c + ',' + opp.Product_Family__c + ',' + opp.TotalOpportunityQuantity + ',' + opp.Sales_Price__c + ',' + opp.Amount + ',' + opp.Description + ',' + opp.CloseDate + '\n';
       }

      Attachment attachment = new Attachment();
      attachment.Body = Blob.valueOf(csvContent);
      attachment.Name = 'csvFile.csv';
      attachment.ParentId = parentid; 
      insert attachment;
Where listCurrentShowOpportunities does not have any limit. I asume it to be size limit of list.
If we consider that I we get about 7000 oppty string csvContent size gets exceeded and I get Apex heap size too large error.
How should I handle this?


 
Error that I am getting is "Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 140.375KB"

I am having a page which has an link i.e, Page 1
<apex:page controller="OpportunitiesRollOverWizardController"
    sidebar="false" >
                        <apex:commandLink value="Export details in .csv format"
                            action="{!downloadOpportunities}" />  
</apex:page>
Page 2 is used to create an .CSV file
<apex:page controller="OpportunitiesRollOverWizardController" cache="true" contentType="text/csv#Export.csv" language="en-US" >"Name","Owner Name","Owner Id","Account Name","Account Id","Stage Name","Probability","Product Family","Total Opportunity Quantity","Amount","Description","Close Date"
<apex:repeat value="{!listOpportunitiesToDownload}" var="record">
<apex:repeat value="{!record}" var="subRecord">
"{!subRecord.Name}","{!subRecord.Owner.FirstName} {!subRecord.Owner.LastName}","{!subRecord.OwnerId}","{!subRecord.Account.Name}","{!subRecord.AccountId}","{!subRecord.StageName}","{!subRecord.Probability}","{!subRecord.Product_Family__c}","{!subRecord.TotalOpportunityQuantity}","{!subRecord.Amount}","{!subRecord.Description}",<apex:outputText value="{0,date,MM/dd/yy}"><apex:param value="{!subRecord.CloseDate}"/></apex:outputText>
</apex:repeat>
</apex:repeat>
</apex:page>
and a controller
 
public with sharing class OpportunitiesRollOverWizardController {
     public  List<List<Opportunity>> listOpportunitiesToDownload{ get; set; }  //List Of Opportunities to a .csv file
     List<Opportunity> listCurrentShowOpportunities;
      
     public OpportunitiesRollOverWizardController(){
        listCurrentShowOpportunities = [select Id from opportunity];
     }
     
     public PageReference downloadOpportunities() {
        PageReference oPageRef = Page.CreateCSVFileForOpprtunityRollOverWizard;
        oPageRef.setRedirect(false);
        List < Opportunity > listOpportunityForCSVFile = new List < Opportunity > ();

        //At the max 1000 Oppties are added to the list for downloading. This is to prevent salesforce governor limits from exceeding.
        //So we are maintaining list of list of Oppties. Each list of 1000 records. These Oppties will then be appended to the final download file.
        for (Integer i = 0; i < listCurrentShowOpportunities.size(); i++) {
            if (listOpportunityForCSVFile.size() < 1000) {
                listOpportunityForCSVFile.add(listCurrentShowOpportunities[i]);
            } //End of if
            else {
                listOpportunitiesToDownload.add(listOpportunityForCSVFile);
                listOpportunityForCSVFile = new List < Opportunity > ();
                listOpportunityForCSVFile.add(listCurrentShowOpportunities[i]);
            } //End of else
        } //End of for
        listOpportunitiesToDownload.add(listOpportunityForCSVFile);
        return oPageRef;
    } //End of downloadOpportunities()
}
      
When I am having more number of opportunity i am getting view state error. Doing listOpportunitiesToDownload Transient also have not solved my problem getting Attempt to de-reference a null object error.I have also refrenced to https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_PageReference_setRedirect.htm and setRedirect(Boolean) to false. But I am getting error for view state. Please need help in solving the view state error.
Thanks, Best Regards.
I want to know if their is any proper documentation format that I have to follow for security review.

I have searched for the document format and got this link
https://developer.salesforce.com/page/Security_Review_Test_Info#3._Documentation

But can anyone please provide me a sample document so that I can use it for reference.

Thanks in Advance
Hi I am creating a   meter gauge chart using VF charting.

Can't I add more then two colors in meter gauge or cant I make markings in three diffrent ways like "Total Revenue" , "Estimated Total Revenue" and "Maximum Revenue"?

And also how can I make its look and feel same as in dashboard?
User-added image
Hi 
I am creating a visual force page and I have to add a funnel chart in the visual force page similar to dashboard funnel component.
 
I am creating a dashboard using Visual force page. I have inserted a meter gauge chart on the page. Now I have to set the maximum value dynamically of the chart this should be like 100k,200k,300k....1m or 100m,200m...1B

How can i add this maximum value dynamically like a setting. And add a maximum value.

<apex:outputPanel id="TotalSales">

                            <apex:outputLabel value="Total Sales" styleClass="Headerclass" />

                            <script>
                            MyChart.on('TotalSales', function(config) {
                            config.axes[0].margin=-10;
                            });
                            </script>

                            <div class="metergaugeCSS"  >
                            <apex:chart name="TotalSales" height="200px" width="100%"
                                animate="true" data="{!TotalSales}" >

                                 <apex:legend position="top" font="bold 8px Helvetica" padding="15"/>

                                <apex:axis type="Gauge" position="gauge"
                                    minimum="0"
                                    maximum="{!TotalSales[0].maxValue}" steps="3"  margin="-15">

                                    <div style="text-align: center; margin-top: -45px;">
                                        <apex:outputText value="{0, number,$###,###}">
                                        <apex:param value="{!TotalSales[0].size}"/>
                                        </apex:outputText>

                                       <br/> Total Order Amount <br/> Invoiced


                                    </div>

                                </apex:axis>   

                                <apex:gaugeSeries dataField="size" donut="50"
                                    colorSet="#78c953,#ddd" />
                            </apex:chart>
                            </div>
                           </apex:outputPanel>
================================================= Controller

  //Get values for Total Sales chart representation.
    public List<gaugeData > getTotalSales() {
        List<AggregateResult> totalSales = [select SUM(Order_Amount__c) totalAmount , Show__r.Name showName from Non_Booth_Item__c where  Show__c =:currentShow.Id and Item_Status__c !='cancelled' Group By Show__r.Name ];
        List<gaugeData> data = new List<gaugeData>();
          Integer maxvalue= Integer.valueOf(currentShow.Estimated_Revenue__c);

        if(!totalSales.isEmpty()){

            Decimal i = ((Decimal) totalSales[0] .get('totalAmount') ).setScale(2);
            data.add(new gaugeData(String.valueOf(totalSales[0].get('showName')), i,maxvalue));

        }
        else
        {
            data.add(new gaugeData('', 0,maxvalue));         
        }
        return data ;
    }
=========

//Wrapper class for showing values on gauge for max and minimum value.
    public class gaugeData {
        public String name { get; set; }
        public Decimal size { get; set; }
        public Integer maxValue {get;set;}

        public gaugeData(String name, Decimal data, Integer maxValue) {
            this.name = name;
            this.size = data;
            this.maxValue = maxValue;
        }
    }Meter gauge with max values
I am creating a wizard in which I have created a VF page which consist of rules.
I want to store this rules, so that when user opens this wizard again I can get all the rules he has used before.

Creating a custom object to store this value is an option but as I am going to have only one setting i.e one record for this custom setting. So creating an object and adding its fields is not a good idea.

Also I have tried to store this values in custom settings, I have serialized all the input values and was  trying to store string in custom setting. But my serialized string is exceeding string length of 255 characters. And in custom settings I am not able to put text area long or more then 255 characters.


Please provide a suggestion or approach for this problem.

Hi,

I am attaching a csv file and following is the code

   

List<Opportunity> listCurrentShowOpportunities = [select Name,OwnerId,AccountId,StageName,Probability,TotalOpportunityQuantity,Amount,Description,CloseDate from opportunity] ;

String csvContent = 'Name,Owner Name,Owner Id,Account Name,Account Id,Stage Name,Probability,Total Opportunity Quantity,Amount,Description,Close Date'+'\n';
      
 for (Opportunity opp : listCurrentShowOpportunities){
        csvContent = csvContent + opp.Name + ',' + opp.Owner.FirstName + opp.Owner.LastName + ',' + opp.OwnerId + ',' + opp.Account.Name + ',' + opp.AccountId + ',' + opp.Show__r.Name + ',' + opp.Show__c + ',' + opp.StageName + ',' + opp.Probability + ',' + opp.Item__c + ',' + opp.Item_Type__c + ',' + opp.Product_Family__c + ',' + opp.TotalOpportunityQuantity + ',' + opp.Sales_Price__c + ',' + opp.Amount + ',' + opp.Description + ',' + opp.CloseDate + '\n';
       }

      Attachment attachment = new Attachment();
      attachment.Body = Blob.valueOf(csvContent);
      attachment.Name = 'csvFile.csv';
      attachment.ParentId = parentid; 
      insert attachment;
Where listCurrentShowOpportunities does not have any limit. I asume it to be size limit of list.
If we consider that I we get about 7000 oppty string csvContent size gets exceeded and I get Apex heap size too large error.
How should I handle this?


 
Error that I am getting is "Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 140.375KB"

I am having a page which has an link i.e, Page 1
<apex:page controller="OpportunitiesRollOverWizardController"
    sidebar="false" >
                        <apex:commandLink value="Export details in .csv format"
                            action="{!downloadOpportunities}" />  
</apex:page>
Page 2 is used to create an .CSV file
<apex:page controller="OpportunitiesRollOverWizardController" cache="true" contentType="text/csv#Export.csv" language="en-US" >"Name","Owner Name","Owner Id","Account Name","Account Id","Stage Name","Probability","Product Family","Total Opportunity Quantity","Amount","Description","Close Date"
<apex:repeat value="{!listOpportunitiesToDownload}" var="record">
<apex:repeat value="{!record}" var="subRecord">
"{!subRecord.Name}","{!subRecord.Owner.FirstName} {!subRecord.Owner.LastName}","{!subRecord.OwnerId}","{!subRecord.Account.Name}","{!subRecord.AccountId}","{!subRecord.StageName}","{!subRecord.Probability}","{!subRecord.Product_Family__c}","{!subRecord.TotalOpportunityQuantity}","{!subRecord.Amount}","{!subRecord.Description}",<apex:outputText value="{0,date,MM/dd/yy}"><apex:param value="{!subRecord.CloseDate}"/></apex:outputText>
</apex:repeat>
</apex:repeat>
</apex:page>
and a controller
 
public with sharing class OpportunitiesRollOverWizardController {
     public  List<List<Opportunity>> listOpportunitiesToDownload{ get; set; }  //List Of Opportunities to a .csv file
     List<Opportunity> listCurrentShowOpportunities;
      
     public OpportunitiesRollOverWizardController(){
        listCurrentShowOpportunities = [select Id from opportunity];
     }
     
     public PageReference downloadOpportunities() {
        PageReference oPageRef = Page.CreateCSVFileForOpprtunityRollOverWizard;
        oPageRef.setRedirect(false);
        List < Opportunity > listOpportunityForCSVFile = new List < Opportunity > ();

        //At the max 1000 Oppties are added to the list for downloading. This is to prevent salesforce governor limits from exceeding.
        //So we are maintaining list of list of Oppties. Each list of 1000 records. These Oppties will then be appended to the final download file.
        for (Integer i = 0; i < listCurrentShowOpportunities.size(); i++) {
            if (listOpportunityForCSVFile.size() < 1000) {
                listOpportunityForCSVFile.add(listCurrentShowOpportunities[i]);
            } //End of if
            else {
                listOpportunitiesToDownload.add(listOpportunityForCSVFile);
                listOpportunityForCSVFile = new List < Opportunity > ();
                listOpportunityForCSVFile.add(listCurrentShowOpportunities[i]);
            } //End of else
        } //End of for
        listOpportunitiesToDownload.add(listOpportunityForCSVFile);
        return oPageRef;
    } //End of downloadOpportunities()
}
      
When I am having more number of opportunity i am getting view state error. Doing listOpportunitiesToDownload Transient also have not solved my problem getting Attempt to de-reference a null object error.I have also refrenced to https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_System_PageReference_setRedirect.htm and setRedirect(Boolean) to false. But I am getting error for view state. Please need help in solving the view state error.
Thanks, Best Regards.
Hi I am creating a   meter gauge chart using VF charting.

Can't I add more then two colors in meter gauge or cant I make markings in three diffrent ways like "Total Revenue" , "Estimated Total Revenue" and "Maximum Revenue"?

And also how can I make its look and feel same as in dashboard?
User-added image