How to filter a pipeline object based on filter screen values

Hints, Tips and Tricks

Technical Hints Tips and Tricks that cover customization and development using Sage CRM. API usage and coding are covered.

How to filter a pipeline object based on filter screen values

  • Comments 2
  • Likes

We know that a LIST block can be filtered based on a standard filter screen block via

var filter = eWare.GetBlock("MyFilterBoxName");
var list = eWare.GetBlock("MyListName");
list.ArgObj = filter;

Can we filter a pipeline object in a similar fashion?

Unfortunately you cannot filter a pipeline object in a similar way.  Instead you need to build the WHERE clause of the SQL that the pipeline is based on from values returned in the Request.Form object.

For example if your pipeline is based on an entity called project and your filter screen had a company field you might have code like the following to cause the pipeline to be filtered by the company field:

var SQLPipe='select count(proj_projectid) as a,'
    +'proj_type from vProject'
    +'where (proj_Companyid='+ Request.Form._HIDDENproj_companyid +') '
    +'group by proj_type order by proj_type';
var ProjPipe=eWare.CreateQueryObj(SQLPipe);

For more information on creating a pipeline object, see Jeff's post here.

Comments
  • Jack / Jeff, I need to create a custom ASP page for a custom entity that displays a Pipeline.  I've read several of the articles, e.g.:

       - www.sagecrm.com/.../GC_EgPipelineExample.htm

       - community.sagecrm.com/.../customizing-the-opportunity-pipeline-summary-information.aspx

    and I get the general idea - at least to build the basics of the Pipeline display - however these examples don't seem to include the filtering your article touches upon, and yet that's a critical feature of a Pipeline / LIst page.  I may be wrong but I don't believe there's a single, full-featured example available that demonstrates a complete working solution, soup-to-nuts, especially including the filtering logic outlined above fully incorporated into the ASP.  Does such a complete example exist? if so, please point me toward it.  If not, is there any chance we could see one on the Community at some point?  The main reason I ask is simply as a reference, since having a complete working ASP page is the best way to model our own extensions.  The other reason I ask is that the code snippets often make various assumptions that may or may not be generally applicable, e.g. "Request.Form._HIDDENproj_companyid" above is clearly specific to this customization, but how would we incorporate similar logic into, e.g. a My CRM 'Jobs' Pipeline?  Again, I'm not really looking for a specific answer to this specific question, rather I'm looking for a single, complete working Pipeline ASP page.  Thanks, gents.

    - Graham

  • Macleod: Please see this post: community.sagecrm.com/.../pipeline-demo.aspx