Schloss Schwanberg Part 9: Editing Guest Information

1 minute read time.

This is the ninth of a series of articles that will walk you through the Schloss Schwanberg case study.

You can download the case study used at the conference here:

https://community.sagecrm.com/partner_community/m/example_training_case_studies_all_versions/default.aspx

You can read the all the existing articles that support the case study here: Schloss Schwanberg.

This article assumes that you have followed all the previous steps.

The previous article discussed adding guest information.

This article will continue the case study and look at how to create the self service page that will allow a customer to edit the details of a wedding guest.

The starting point is the page "bookingdetail.asp".

And edit page can be called from the Guest List by adding a hyperlink to one of the columns displayed. This can be done within the meta data definition of the list.

The hyperlink added calls the editguest.asp page.

The page can use the same screen block created to allow the addition of new Guest records. I called this 'ssGuestEntry'.

Creating the Code for the Edit Guest page.

The code for the editguest.asp can be separated out into editguestpagecode.js and an 'include' can link the code to the ASP page. This allows editguest.asp to be used to control the general style and layout of the page.

Below is the code contained in editguestpagecode.js.

[code language="javascript"]
<%
if (!CRM.Authenticated)
{
//Logon function defined in eWaress.js
//assumes ewarelogon.inc in folder
eWareLogin();
}
else
{
var intVisitorId = CRM.VisitorInfo("visi_personid");
var strKeyID= "gues_guestid";
var Id = new String(Request.Querystring(strKeyID));
var intRecordId = 0;
if (Id.indexOf(",") > 0)
{
var Idarr = Id.split(",");
intRecordId = Idarr[0];
}
else if (Id != "")
{
intRecordId = Id;
}
//security check
var guestRecord = CRM.FindRecord("guest","gues_guestid="+intRecordId + " and gues_personid = "+intVisitorId );
if (guestRecord.eof)
{
Response.Redirect("index.asp");
}
if (CRM.Mode==View)
{
CRM.Mode = Edit;
}
var myBlock = CRM.GetBlock("ssGuestEntry");
Response.Write(myBlock.Execute(guestRecord));
if (CRM.Mode ==Save)
{
Response.Redirect("bookingdetails.asp?oppo_opportunityid="+guestRecord.gues_opportunityid);
}
}
%>
[/code]

Notes

  1. Guest ID (gues_guestid) is passed as the unique ID of the guest record. This is used to retrieve the guest record displayed in the ssGuestEntry screen. The visi_personid retrieved by in the VistorInfo() method is used to ensure that a customer can only see their own data.