Creating and controlling List Pages in Self Service

Less than one minute read time.

Below is a very simple example of a self service page displaying a list of Cases belonging to an authenticated visitor.

The ASP code is found below. The code is marked in different colours and discussed in a following section.


 

" HREF=\"eware.css\">";
var Body="";
var EndBody="";
Response.Write(Head);
Response.Write(Body);
if (CRM.Authenticated)
{
var intRecordId = CRM.VisitorInfo("visi_personid");
var PersonRecord = CRM.FindRecord('person','pers_personid='+intRecordId);
var myBlock = CRM.GetBlock("sscaselist");
var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
  AddBlock(myBlock);
}
//Controlling and Setting Properties of GridColumns
var gridColCreatedDate = myBlock.DeleteGridCol("case_createddate");
var gridColStatus = myBlock.AddGridCol("case_status");
with (gridColStatus)
{
  AllowOrderBy = true;
  JumpAction= 430;
  CustomActionFile = "caseedit.asp";
  CustomIdField = "case_caseid";
}

myBlock.AddButton(BuildButton("new","new.gif","caseadd.asp"));
function BuildButton(ButtonName,ButtonImage,ButtonURL)
{
var strImagePath = "/CRM62/img/Buttons/";
var strButton = "";
strButton += "
"; strButton += ""; strButton += ""; strButton += ""+eWare.GetTrans("Button",ButtonName)+""; strButton += "
"; return strButton; } var Arg = "case_primarypersonid="+intRecordId; Response.Write(myBlock.Execute(Arg)); } else { Response.Redirect("customlogon.asp"); } Response.Write(EndBody); %>

Controlling and Setting Properties of GridColumns

This section shows that you can edit the consituent columns of a List block. You can remove and add new columns programmatically and you can set properties such as hyperlinks easily.