This article covers the concept of Scope as it relates to objects in a Slate database.
A Slate database includes many standard and custom object types to store record data. Each object type has a stored relationship with a particular record, known as its scope. The relationship created using scope will, for example, ensure that data scoped to a constituent record stays connected to that person's record and is not available for use with other objects.
Objects can have their own scope and be related to other objects in the database. Objects like gifts, addresses, devices, and jobs are scopes unto themselves, yet they are also associated with person, dataset, or relation records. In Slate terms, these objects might be referred to in the context of the record on which they reside.
For example, a constituent's address can be referred to as a person-scoped address because the address data is related to the constituent record containing the address data. Likewise, a company's address could be referred to as Companies and Foundations scoped because a record in the Companies and Foundations dataset contains the address.
Field Scope Examples
To capture a primary constituent type for a person record, the field must have the scope set to person. With the relation between the field and the person established, the database can then treat the data stored in the field as if it was stored on the person record.
Having the Primary Constituent Type custom field scoped to Person ensures that the field is only available for person records in other areas of the database.
Capturing a stock symbol for a gift requires a custom gift-scoped field. As with the previous example, the relationship established between the gift and the custom field enables the database to treat the data stored in the custom field as if it was stored on the gift.
The Stock Symbol custom field scoped to Gift ensures that the field is only available for gifts in other areas of the database.
Form Scope Examples
Primary Form Scope
Form submissions are another example of an object linked to another object through scope.
When creating a form, the scope is used to determine the primary object types that the form should have a relationship with. A form scoped to person will relate the form to a person record in the database. The primary relationship through the form scope will also determine the object the form submission will reside with.
For example, a submitted online giving form scoped to person will reside with the person record the form is submitted for.
With a primary scope of a form established, the database can then determine the other objects accessible for the form. While gifts have their own scope, gifts can also be related to a person or dataset record. Gift fields added to a form scoped to person will create a relationship between the gift fields and the person record for which the form is being submitted. Likewise, if the form's primary scope is to a specific dataset, like Companies and Foundations, any gift fields added to the form would relate to the dataset record for which the form is being submitted.
Subgrouping Scoped Objects
When scope relates to an object encompassing subsets of grouped data (for example, the dataset scope), there will be an additional option to relate the scope to one of the subsets of data. In the following example, the Scope of Dataset has been selected, followed by the subset of Companies and Foundations.