You need to sign in to do that
Don't have an account?
Use List button to pass parameter to @RemoteAction in Visualforce page controller
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 :
Visualforce Page:
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>
Hope this helps.
All Answers
Hope this helps.