Creating and Controlling an Insert Page in Self Service

Hints, Tips and Tricks

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

Creating and Controlling an Insert Page in Self Service

  • Comments 2
  • Likes

Below is a very simple example of a self service page that allows a case belonging to an authenticated visitor to be edited.

The ASP code is found below.   The code is comment and discussed below.

<%@CodePage=65001 Language=JavaScript    %>
<!-- #include file ="ewaress.js" -->
CRM = eWare;
var View=0, Edit=1, Save=2, PreDelete=3, PostDelete=4, Clear=6;
var Bottom=0, Left=1, Right=2, Top=3;
var CapDefault=0, CapTop=1, CapLeft=2, CapLeftAligned=3, CapRight=4, CapRightAligned=5, CapLeftAlignedRight=6;
var Button_Default="1", Button_Delete="2", Button_Continue="4";
var Head="<HTML><HEAD><LINK REL=\"stylesheet\" HREF=\"eware.css\"><META http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
var Body="<BODY>";
var EndBody="</BODY></HTML>";
if (CRM.Authenticated)
if (CRM.Mode == View)
CRM.Mode = Edit;
//Uses Self Service User context to retrieve Person data.
var intRecordId = CRM.VisitorInfo("visi_personid");
var PersonRecord = CRM.FindRecord('person','pers_personid='+intRecordId);
var CaseRecord = CRM.CreateRecord("cases");

//Setting field values and workflow state
CaseRecord.case_primarypersonid= intRecordId;
CaseRecord.case_primarycompanyid= PersonRecord.pers_companyid;
CaseRecord.case_status= "In Progress";
CaseRecord.SetWorkflowInfo("Case Workflow", "Logged");
//Control and Setting Properties of Entry Blocks
var myBlock = CRM.GetBlock("sscaseentry");
//myBlock.Title = CRM.GetTrans("tabnames","cases");
var entryBlock = myBlock.GetEntry("case_problemnote");
var entryDescription = myBlock.AddEntry("case_description",1,false);
var entrySource = myBlock.AddEntry("case_source",-1,true);
var entryCustomerRef = myBlock.AddEntry("case_customerref",-1,true);
entryCustomerRef.NewLine = false;
var strHTML = myBlock.Execute(CaseRecord);
if (CRM.Mode == Save)

Setting field values and workflow state

This section demonstrates how the initial workflow state of a newly created record can be set.  Also non displayed field values can be set here. 

Control and Setting Properties of Entry Blocks

This section shows that you can edit the consituent fields (entry blocks) of a screen (EntryGroup) block.  You can remove and add new fields programmatically and you can set properties such as NewLine easily.

  • So, does this page (and the "user editing" within it)  also update the case progress table / workflow ?

  • The case progress table is updated as part of the CRM system action so if you are building your own behaviour then you will have to look after that yourself.