Guides (SDK /API)Technical ReferenceBBDNHow-to Documentation

You are here: Custom Parts Example: Pledge Form > Code the Add the Pledge Logic (Custom Pledge Records)

Code the Add the Pledge Logic (Custom Pledge Records)

  1. Open CustomPledgeFormDisplay.ascx for editing in Designer.

  2. Double-click the Pledge button. CustomPledgeFormDisplay.ascx.vb appears in the editor with a newly added handler for clicking the button. The new Sub procedure should look like this:

        Protected Sub ButtonPledge_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonPledge.Click
    
        End Sub
  3. Create a Sub procedure to write a CustomPledgeRecord.

        Private Sub AddCustomPledgeRecord()
    
        End Sub
  4. Using the BBMetalWeb generated classes, create an object to hold the form data.

            Dim CustomPledgeData As New PartsProjectExample.AddForms.CustomPledge.CustomPledgeRecordAddDataFormData()
  5. Load default values into the form data.

            CustomPledgeData = PartsProjectExample.AddForms.CustomPledge.CustomPledgeRecordAddDataForm.LoadData(Me.API.AppFxWebServiceProvider)
  6. Populate the object with form data.

            CustomPledgeData.AMOUNT = TextBoxAmount.Text
            If Not API.Users.CurrentUser.IsAnonymous Then
                CustomPledgeData.CONSTITUENTID = API.Users.CurrentUser.BackOfficeGuid
            End If
            CustomPledgeData.EMAIL = TextBoxEmail.Text
            CustomPledgeData.FIRSTNAME = TextBoxFirst.Text
            CustomPledgeData.KEYNAME = TextBoxLast.Text
            CustomPledgeData.MIDDLENAME = TextBoxMiddle.Text
  7. Using BBMetalWeb generated classes and the BBIS connection to the web service, create the load request for the Add Data Form.

            CustomPledgeData.Save(Me.API.AppFxWebServiceProvider)
  8. Call AddCustomPledgeRecord() from the button handler based on the conditions of the design. For now, call AddCustomPledgeRecord in any case.

            If MyContent.OnlyWriteToCustomPledgeRecord Then
                AddCustomPledgeRecord()
            ElseIf API.Users.CurrentUser.IsAnonymous Then
                AddCustomPledgeRecord()
            End If