Monday, 11 October 2010

Adding Custom Fields

I know all you aspiring SFDC Developers have been waiting patiently for my next post and I’m sorry for the delay. Fleet week was going on in San Francisco so of course I had to partake in the festivities. But I’m back and ready to start teaching again.

Now that we have designed our application, we need to begin adding custom fields and define the parent/child relationship. To start this simply scroll down to the ‘Custom Fields & Relationships’ and open a new custom field wizard. Select ‘Master-Detail Relationship’ and click ‘Next’. Change ‘Related To’ to ‘Scheduled Invoice’, and click ‘Next’. Set the ‘Field Label’ to ‘Invoice’, and press ‘Tab’, this will instantly set the field name to ‘Invoice’ as well. Finally click ‘Next’ to finish. Below you will see a screen shot of what the custom field wizard page looks like:


After the aforementioned steps have been completed, the page layout editor screen will appear. This is a simple drag & drop GUI editor that SFDC developers use to define the presentation of the Scheduled Invoice object. Basically page layouts create the characterization of how a specific custom object is displayed. You can have multiple page layouts characterize for a specific object. This gives different views of that object based on either user’s profile or the object data. The object data is also known as the Record Type. We will leave the page layout in default for now and click ‘Next’.

Another screen we are going to leave in the default setting for now is the Custom Related List. The screen only appears in the custom field wizard when adding a Master-Detail Relationship field or a Look-up field. The main purpose of this screen is to define a ‘Related List Label’, which is used when displaying the list of Scheduled Payments on the Scheduled Invoice screen. Again we will leave this is the “Scheduled Payments” default and move to the final step; which is giving the Master-Detail relationship a name that you can reference from the Salesforce API or Apex Code. Type “Scheduled_Payments” for the ‘Child Relationship Name’ in the ‘Edit’ link next to the Invoice field of the ‘Custom Fields & Relationships’ section. It is important you set a name for this relationship or the system will use designate an 18-character alphanumeric internal identifier.

Repeat this process and input the following data to add three more fields:

    Field Type: Date
    Field Label: Due Date
    Field Name: Due_Date
    Required: Checked

    Field Type: Currency
    Field Label: Amount Due
    Field Name: Amount_Due
    Length: 16
    Decimal Places: 2
    Required: Checked

    Field Type: Picklist
    Field Label: Status
    Field Name: Status
    Values:
        Pending
        Paid
        Past Due
    Use first value as default value: Checked

At this point you need to add custom fields to our Scheduled Invoice object. In the ‘Build’ menu under the ‘Objects’ option, you simply need to select or ‘Scheduled Invoice’ app from the list of custom objects.

Repeat this process and input the following data to add six necessary fields:

    Field Type: Date
    Field Label: Effective Date
    Field Name: Effective_Date
    Required: Checked

    Field Type: Number
    Field Label: Duration in Months
    Field Name: Duration_in_Months
    Length: 3
    Decimal Places: 0
    Required: Checked

    Field Type: Currency
    Field Label: Total Amount Due
    Field Name: Total_Amount_Due
    Length: 16
    Decimal Places: 2
    Required: Checked

    Field Type: Email
    Field Label: Primary Customer Contact
    Field Name: Primary_Customer_Contact
    Required: Checked

    Field Type: Picklist
    Field Label: Schedule Type
    Field Name: Schedule_Type
    Values:
        Monthly
        Bi-Weekly
        Weekly
    Use first value as default value: Checked

    Field Type: Picklist
    Field Label: Status
    Field Name: Status
    Values:
        Current
        Past Due
       Paid in Full
    Use first value as default value: Checked

We are going to stop here but next post we will begin adding more required fields.

No comments:

Post a Comment