Adding a Pipeline graphic to List using .Net API in Sage CRM

By | September 30, 2019

Sage CRM has proved to be very much flexible when it comes to accommodating customizations as per the business needs. Recently we came across a requirement, where the Client was not only interested in getting the access to the records assigned to a particular user but also in getting a proper view of all the records which are created by the user.

New Stuff:Security Policies applied to Library entity with release of Sage CRM 2019 R2

Just like Team CRM helps the Team Managers to get a view of all the records their subordinates or team members are working on (assigned to); our Client had a requirement of one such list wherein the user would be able to view all the records which are created by them along with the graphical pipeline. This indeed helped them to track the current status of the records with an ease.

Since we do not have any option other than making the user navigate to the search screen and look for the respective record; we thought of creating a Custom list in Sage CRM. But in order to display the pipeline against these custom list you need to add below code under the standard custom list code itself –

<Snippet>

public override void BuildContents()

  {

  try

  {

                AddContent(HTML.Form());

  GetTabs(“User”);

  if (CurrentUser[Sage.UserOptions.CasePipeline] == “Y”)

  {

  PipelineGraphicBlock myPipe = new PipelineGraphicBlock();

  int intUserID = CurrentUser.UserId;

  string sWhere = “Case_Deleted IS NULL AND Case_CreatedBy=” + intUserID;

  string stageArg = Dispatch.EitherField(“case_stage”);

  if (stageArg == “” || stageArg == null || stageArg == “undefined” || stageArg == “sagecrm_code_all”) stageArg = “0”;

  string statusArg = Dispatch.EitherField(“case_status”);

  if (statusArg == “” || statusArg == null || statusArg == “undefined” || statusArg == “sagecrm_code_all”) statusArg = “0”;

  if (stageArg != “0”)

  {

  sWhere += ” AND case_stage='” + stageArg + “‘”;

  }

  if (statusArg != “0”)

  {

  sWhere += ” AND case_status='” + statusArg + “‘”; }

  myPipe.PipelineStyle(PipelineStyles.Shape, “Circle”);

  myPipe.PipelineStyle(PipelineStyles.UseGradient, “False”);

  myPipe.PipelineStyle(PipelineStyles.Animated, “False”);

  myPipe.PipelineStyle(PipelineStyles.SelectedWidth, “10”);

  myPipe.PipelineStyle(PipelineStyles.SelectedHeight, “10”);

  myPipe.PipelineStyle(PipelineStyles.PipeWidth, “40”);

  myPipe.PipelineStyle(PipelineStyles.PipeHeight, “10”);

  myPipe.PipelineStyle(PipelineStyles.ShowLegend, “True”);

  string strSQL = “select case_stage, count(*) as t from Cases with (nolock) where ” + sWhere + ” group by case_stage”;

  QuerySelect queryObj = new QuerySelect();

  queryObj.SQLCommand = strSQL;

  queryObj.ExecuteReader();

  string strStage = “”, strSectionScript = “”, strOrgStage = “”;

  int iSeleted = 0;

  if(!queryObj.Eof())

  {

  while (!queryObj.Eof())

  {

  if (queryObj.FieldValue(“t”) != “0”)

  {

  strOrgStage = queryObj.FieldValue(“case_stage”);

  strStage = Metadata.GetTranslation(“case_stage”, strOrgStage);

  if (strOrgStage == statusArg)

  {

  strSectionScript = “javascript:document.EntryForm.case_stage.selectedIndex=(document.EntryForm.case_stage.length-2) ;document.EntryForm.submit();”;

  myPipe.AddPipeEntry(strStage, System.Convert.ToInt32(queryObj.FieldValue(“t”)), strStage + “: ” + queryObj.FieldValue(“t”), strSectionScript);

  myPipe.Selected = iSeleted;

  }

  else

  {

  strSectionScript = “javascript:document.getElementById(‘case_stage’).options[SageCRM.webObject.GetDropDownIndexByValue(document.getElementById(‘case_stage’),'”;

  strSectionScript = strSectionScript + strOrgStage + “‘)].selected = true;document.EntryForm.submit();”;

  myPipe.AddPipeEntry(strStage, System.Convert.ToInt32(queryObj.FieldValue(“t”)), strStage + “: ” + queryObj.FieldValue(“t”), strSectionScript);

  }

  }

  queryObj.Next();

  iSeleted++;

  }

  myPipe.DisplayForm = false;

  HTMLString htmlPipe = new HTMLString();

  htmlPipe.Html = myPipe.Execute();

  string strhtmlPipe = htmlPipe.ToHtml();

  AddContent(strhtmlPipe);

  }

  }

  base.BuildContents();

  }

  catch (Exception e)

  {

  AddContent(“Error Description “+e.Message);

  }

  //throw new System.NotImplementedException();

  }

</Snippet>

After adding above code, the list as well as the pipeline will be filtered out based on the created by user’s condition in CRM. Also the pipeline will only be enabled if under User preferences ‘Show Cases Pipeline’ (for above example) is set as Yes.

Graphic Pipeline designed for Custom List

Graphic Pipeline designed for Custom List

About Us

Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix has some unique integration solutions for Sage CRM with Sage ERPs Sage X3 (Sage Enterprise Management)Sage Intacct, Sage 100Sage 500 and Sage 300).We also offer best-in-class Sage ERP and Sage CRM customization and development services to Business Partners, End Users and Sage PSG worldwide. Greytrix helps in migrating of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes Greytrix Business Manager, Sage CRM Project Manager, Sage CRM Resource Planner, Sage CRM Contract Manager, Sage CRM Event Manager, Sage CRM Budget Planner, Gmail Integration, Sage CRM Mobile Service Signature and Sage CRM CTI Framework.

Greytrix is a recognized Sage Rockstar ISV Partner for GUMU™ Sage X3 – Sage CRM integration also listed on Sage Marketplace.

For more information on our integration solutions, please contact us at sage@greytrix.com. We will be glad to assist you.