• Ramona McCook
  • NEWBIE
  • 9 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
Would someone please help me pass that ID from the current object to a controller's @RemoteAction using a detail list button?
I have tried System.currentPageReference().getparameters().get() but that doesn't work within @RemoteAction

The following is my controller, where I need my SELECT statement to filter by the objectID from which the custom detail button is pressed :
global with sharing class googlegantchartscope {  

public String oppList { get; set; }
    
@RemoteAction
global static Cluster__c[] loadrecords() {
    /*String testID = {!$currentpage.parameters.marketID}; 'a0Sc0000003GHNC'; System.currentPageReference().getparameters().get('marketID');*/
    
    return [select Name, Gantt_Chart_Name__c, Design_Completed__c, Estimated_Permit_Approval_Completion__c, Duration__c, Percent_Complete__c, Dependencies__c from Cluster__c where Design_Completed__c!=Null AND Market__c = :needCustomObjectIDFromDetailButtonHere];}
}

Visualforce Page:
<apex:page controller="googlegantchartscope">
<apex:includeScript id="a" value="https://www.google.com/jsapi" />
<apex:sectionHeader title="Google Charts + Javascript Remoting" subtitle="Demo of Cluster Scheduling" />
<div id="chart_div" />
    

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
 <script type="text/javascript">
 <!--loads the visualization in gant chart view-->
 google.charts.load('current', { 'packages': ['gantt']});
 google.charts.setOnLoadCallback(InitCharts);
  
 function InitCharts() {
 <!-- calls the function called 'loadrecords' in googlegantchart controller-->
 googlegantchartscope.loadrecords( 
     
 <!-- following the usual remoting syntax-->
 function(result, event) {
 
 var visualization = new google.visualization.Gantt(document.getElementById('chart_div'));
 <!--adding data to Chart-->
 var data = new google.visualization.DataTable();<!-- variable declaration-->
  
 data.addColumn('string', 'Cluster');
 data.addColumn('string','Cluster and Priority');
 data.addColumn('date', 'Design Completed');
 data.addColumn('date', 'Est Permit Approval Completion');
 data.addColumn('number', 'Duration');
 data.addColumn('number', 'Percent Complete');
 data.addColumn('string', 'Dependencies'); 
 
 for (var i = 0; i < result.length; i++) {
 var r = result[i];
     /*data.addRow([r.Task_Id__c, r.Task_Name__c, new Date(r.Start_Date__c), new Date(r.End_Date__c), r.Duration__c,r.Percent_Complete__c,r.Dependencies__c]);*/
     data.addRow([r.Name, r.Gantt_Chart_Name__c, new Date(r.Design_Completed__c), new Date(r.Estimated_Permit_Approval_Completion__c), r.Duration__c, r.Percent_Complete__c, r.Dependencies__c]);
 }
 var options = {
 height: i*50,
 gantt: {
 criticalPathEnabled:true
 }
 };
 visualization.draw(data, options);<!-- draws a table that contains the result of data-->
 },{escape:true});
 }
 </script>
 
</apex:page>


 
Would someone please help me pass that ID from the current object to a controller's @RemoteAction using a detail list button?
I have tried System.currentPageReference().getparameters().get() but that doesn't work within @RemoteAction

The following is my controller, where I need my SELECT statement to filter by the objectID from which the custom detail button is pressed :
global with sharing class googlegantchartscope {  

public String oppList { get; set; }
    
@RemoteAction
global static Cluster__c[] loadrecords() {
    /*String testID = {!$currentpage.parameters.marketID}; 'a0Sc0000003GHNC'; System.currentPageReference().getparameters().get('marketID');*/
    
    return [select Name, Gantt_Chart_Name__c, Design_Completed__c, Estimated_Permit_Approval_Completion__c, Duration__c, Percent_Complete__c, Dependencies__c from Cluster__c where Design_Completed__c!=Null AND Market__c = :needCustomObjectIDFromDetailButtonHere];}
}

Visualforce Page:
<apex:page controller="googlegantchartscope">
<apex:includeScript id="a" value="https://www.google.com/jsapi" />
<apex:sectionHeader title="Google Charts + Javascript Remoting" subtitle="Demo of Cluster Scheduling" />
<div id="chart_div" />
    

<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
 <script type="text/javascript">
 <!--loads the visualization in gant chart view-->
 google.charts.load('current', { 'packages': ['gantt']});
 google.charts.setOnLoadCallback(InitCharts);
  
 function InitCharts() {
 <!-- calls the function called 'loadrecords' in googlegantchart controller-->
 googlegantchartscope.loadrecords( 
     
 <!-- following the usual remoting syntax-->
 function(result, event) {
 
 var visualization = new google.visualization.Gantt(document.getElementById('chart_div'));
 <!--adding data to Chart-->
 var data = new google.visualization.DataTable();<!-- variable declaration-->
  
 data.addColumn('string', 'Cluster');
 data.addColumn('string','Cluster and Priority');
 data.addColumn('date', 'Design Completed');
 data.addColumn('date', 'Est Permit Approval Completion');
 data.addColumn('number', 'Duration');
 data.addColumn('number', 'Percent Complete');
 data.addColumn('string', 'Dependencies'); 
 
 for (var i = 0; i < result.length; i++) {
 var r = result[i];
     /*data.addRow([r.Task_Id__c, r.Task_Name__c, new Date(r.Start_Date__c), new Date(r.End_Date__c), r.Duration__c,r.Percent_Complete__c,r.Dependencies__c]);*/
     data.addRow([r.Name, r.Gantt_Chart_Name__c, new Date(r.Design_Completed__c), new Date(r.Estimated_Permit_Approval_Completion__c), r.Duration__c, r.Percent_Complete__c, r.Dependencies__c]);
 }
 var options = {
 height: i*50,
 gantt: {
 criticalPathEnabled:true
 }
 };
 visualization.draw(data, options);<!-- draws a table that contains the result of data-->
 },{escape:true});
 }
 </script>
 
</apex:page>


 
Hi guys,
I have a image formula text field. Whenever I run the report and export it but on excel sheet it doesn't show the image. It is only showing the url where I saved the images in salesforce. Can someone please help me that how can I export image on excel sheet? Or can someone help me the alternative. Actually I was required to have color background red green and yellow for almost 6 fields with the different criteria. For example if percentage is less then 25% color background should be Red and If it is more then 75% green and between 25% to 75% Yellow background.
  • March 12, 2014
  • Like
  • 0