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 and one of the oldest Sage Development Partners is a one-stop solution provider for Sage ERP and Sage CRM organizational needs. Being acknowledged and rewarded for multi-man years of experience and expertise, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third-party add-on development, and implementation competence.

Greytrix has some unique integration solutions developed for Sage CRM with Sage ERPs namely Sage X3Sage IntacctSage 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 the migration of Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer. Our Sage CRM Product Suite includes addons like  Greytrix Business ManagerSage CRM Project ManagerSage CRM Resource PlannerSage CRM Contract ManagerSage CRM Event ManagerSage CRM Budget PlannerGmail IntegrationSage CRM Mobile Service SignatureSage CRM CTI Framework.

Greytrix is a recognized Sage Champion Partner for GUMU™ Sage X3 – Sage CRM integration listed on Sage Marketplace and Sage CRM – Sage Intacct integration listed on Sage Intacct Marketplace. The GUMU™ Cloud framework by Greytrix forms the backbone of cloud integrations that are managed in real-time for the processing and execution of application programs at the click of a button.

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