Schloss Schwanberg Part 2: Defining the Lead Screens for the Self Service Site

2 minute read time.

This is the second 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 first part here: Starting the Case Study - Setting Up the Self Service Site

You should have the example Schloss Schwanberg corporate website installed and configured on your server.

This part of the series will guide you through the set up of the additional fields needed for the case study in the Lead table. It will then guide you through the creation of the screens (a.k.a. entrygroup blocks) needed for the self service site.

The Lead Fields

The case study describes the following fields that are needed explicitly for the case study.

  • Principal Contact Details (Lead_personfirstname, Lead_personlastname)
  • Bride's Name (Lead_spouse1firstname, Lead_spouse1lastname)
  • Groom's Name (Lead_spouse2firstname, Lead_spouse2lastname)
  • Planned Date of Wedding (Lead_WeddingDate)
  • Event Time, Morning/Afternoon/All Day (Lead_WeddingTime)
  • Planned Number of Guests (Lead_WeddingGuestNumber)

The fields Lead_personfirstname and Lead_personlastname already exist in the Leads table in CRM so do not need to be added. But the other fields do need to be added.

You will need to use your judgement on how to create these. I added them with the following entry types and lengths.

  • lead_spouse1firstname, Text, Length 30
  • lead_spouse1lastname, Text, Length 30
  • lead_spouse2firstname, Text, Length 30
  • lead_spouse2lastname, Text, Length 30
  • lead_weddingdate, Date
  • lead_weddingtime, Selection List
  • (Note: You should add this with a new selection list with the values provided by the case study)
  • lead_weddingguestnumber Integer, Length 2

Note: Although the case study does not mention required fields these are all expected values so should be made mandatory.

Once new fields have been added into the system the screen blocks that will be used to capture the enquiry data need to be created.

Creating the Screens

I created 2 new screens.

Note: The are prefixed with the letters SS to allow easy indentification of screens used by Self Service.

SSEnquiryMainContactBox. This contains the standard contact detail information for the person making the enquiry.

SSEnquiryWeddingDetailBox. This contains the new fields added that capture the details of the the wedding.

The case study has the business rule "The Maximum number of Guests that can be accommodated is 80". This rule needs to be implemented within the Lead "SSEnquiryWeddingDetailBox" screen.

The following scripts can be added into the lead_weddingguestnumber field.

onChange Script

[code language="javascript"]
if(this.value > 80)
{
this.value = 80;
var strMessage = 'Maximum number of guests that can be accommodated is 80';
window.alert(strMessage);
}
[/code]

Note: Avoid using "" Double quotes in your onChange scripts.

Validate Script

[code language="javascript"]
var intGuests = Values("lead_weddingguestnumber") *1;
if (intGuests > 80)
{
Valid = false;
ErrorStr = "Maximum number of guests that can be accommodated is 80";
}
[/code]

The next article will look at using these meta data definitions in the code to add a new enquiry into the Lead table.