Step 2: Add code to get, display, and format blocks

In the CustomPage.cs file, add the following code between the braces in the BuildContents() method:

  1. Set up the HTML form in which the screens are displayed:
    Copy
    public override void BuildContents()
        {
            AddContent(HTML.Form());
        }
  2. Add code to get the blocks or screens that allow the user to enter data, display and format them, and save the data entered by the user:
    Copy
    public override void BuildContents()
        {
            AddContent(HTML.Form());
            EntryGroup screenCompanyBoxLong = new EntryGroup("CompanyBoxLong");
            screenCompanyBoxLong.Title = Metadata.GetTranslation("tabnames", "company");
            EntryGroup screenPersonBoxLong = new EntryGroup("PersonBoxLong");
            screenPersonBoxLong.Title = Metadata.GetTranslation("tabnames", "person");
            EntryGroup screenOppo = new EntryGroup("OpportunityDetailBox");
            screenOppo.Title = Metadata.GetTranslation("tabnames", "opportunity");
        }
  3. Get the current mode stored in the HiddenMode hidden field (that is, Save or Edit):
    Copy
    string hMode = Dispatch.EitherField("HiddenMode");
    if (hMode == "Save")
        {
            // Add code for saving.
        }
        
        else
            {
                // Add code for displaying the forms.
            }

Now follow the instructions in Step 3: Add code to the if and else statements.