Code sample: Adding a pipeline
Copy
<!-- #include file ="sagecrm.js" -->
<%
var CompId=CRM.GetContextInfo('company','comp_companyid');
var SQLPipe='select sum(Oppo_Forecast) as a,' +'Oppo_Stage from vOpportunity '+'where (Oppo_PrimaryCompanyid='+CompId+') ' +'group by Oppo_Stage order by Oppo_Stage';
var Querypipe=CRM.CreateQueryObj(SQLPipe);
Querypipe.SelectSQL();
var pipe=CRM.GetBlock('pipeline');
while (!Querypipe.EOF)
{
Label=Querypipe('Oppo_Stage');
Value=Querypipe('a');
pipe.AddPipeEntry(Label,parseFloat(Value),Value+"");
Querypipe.Next();
}
// Setting the active section of the pipeline.
// This can be altered to be variable controlled.
pipe.Selected=2;
// The summary allows the addition of any desired text in HTML format for the selected pipe section.
// This example shows a simple hard-coded value.
pipe.Pipe_Summary='<table><td class=TableHead>Qualified(70)</td></table>';
CRM.AddContent(pipe.Execute());Response.Write(CRM.GetPage());
%>