• PrIy@nK@
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies

Hello

I have been trying to work in Professional edition where apex classes are not supported. Here is a currency field in opportunities called "recent sale". So, here I need to create a visualforce page and use it to create a dashboard which should show the percentage of total of "recent value" field of all the opportunity records having status as "Closed Won" against the total of "recent value" field of all the opportunity records.

For example, if I am having 100 opportunity records, each having "recent value" as $10.0, and having 25 records among those with status as "Closed won", then the percentage needed here is (25*10)*100/100*10. i.e. the percentage of total "recent value" of "Closed Won" opportunities only.

So, I have been tryin to create a VF for this purpose. Following is the code I am using:

<apex:page showHeader="false" sidebar="false" standardStylesheets="true">


<script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script>

<script type="text/javascript">
    function initPage() {
          sforce.connection.sessionId = '{!$Api.Session_ID}';
          var closedWonOpp = sforce.connection.query("SELECT StageName, Most_Recent_Value__c FROM Opportunity where StageName = 'Closed Won'");
          var Opp = sforce.connection.query("SELECT StageName, Most_Recent_Value__c FROM Opportunity");
  
          var msvcw=0;
          var msvopp=0;
          for (var i=0; i<closedWonOpp.records.length; i++){
                 msvcw=msvcw + parseInt(closedWonOpp.records[i].get("Recent_Value__c"));         
          }
   
         for (var i=0;i<Opp.records.length;i++){
                 msvopp=msvopp+ parseInt(Opp.records[i].get("Recent_Value__c"));
          }
  
         var p=0;
         var p=msvcw*100/msvopp;
         alert("Recent value ercentage of closed won records is :" +p+"%");

     }

  </script>
 
    <apex:form >
        <apex:commandButton value="click" onclick="initPage();"/>
    </apex:form>  
</apex:page>


On click of the button, I am able to get all the correct percentage value in the dialogue box. But not able to figure out how to put them into the visualforce page and create a dashboard.

NOTE: Apex classes can't be used.

Hello

I have been trying to work in Professional edition where apex classes are not supported. Here is a currency field in opportunities called "recent sale". So, here I need to create a visualforce page and use it to create a dashboard which should show the percentage of total of "recent value" field of all the opportunity records having status as "Closed Won" against the total of "recent value" field of all the opportunity records.

For example, if I am having 100 opportunity records, each having "recent value" as $10.0, and having 25 records among those with status as "Closed won", then the percentage needed here is (25*10)*100/100*10. i.e. the percentage of total "recent value" of "Closed Won" opportunities only.

So, I have been tryin to create a VF for this purpose. Following is the code I am using:

<apex:page showHeader="false" sidebar="false" standardStylesheets="true">


<script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script>

<script type="text/javascript">
    function initPage() {
          sforce.connection.sessionId = '{!$Api.Session_ID}';
          var closedWonOpp = sforce.connection.query("SELECT StageName, Most_Recent_Value__c FROM Opportunity where StageName = 'Closed Won'");
          var Opp = sforce.connection.query("SELECT StageName, Most_Recent_Value__c FROM Opportunity");
  
          var msvcw=0;
          var msvopp=0;
          for (var i=0; i<closedWonOpp.records.length; i++){
                 msvcw=msvcw + parseInt(closedWonOpp.records[i].get("Recent_Value__c"));         
          }
   
         for (var i=0;i<Opp.records.length;i++){
                 msvopp=msvopp+ parseInt(Opp.records[i].get("Recent_Value__c"));
          }
  
         var p=0;
         var p=msvcw*100/msvopp;
         alert("Recent value ercentage of closed won records is :" +p+"%");

     }

  </script>
 
    <apex:form >
        <apex:commandButton value="click" onclick="initPage();"/>
    </apex:form>  
</apex:page>


On click of the button, I am able to get all the correct percentage value in the dialogue box. But not able to figure out how to put them into the visualforce page and create a dashboard.

NOTE: Apex classes can't be used.