Loading
Ongoing maintenance for Salesforce HelpRead More
Feature degradation | Gmail Email delivery failureRead More
Visual Studio Code Based Modeler for Consumer Goods Cloud
Table of Contents
Select Filters

          No results
          No results
          Here are some search tips

          Check the spelling of your keywords.
          Use more general search terms.
          Select fewer filters to broaden your search.

          Search all of Salesforce Help
          Business Object Contracts

          Business Object Contracts

          Use a business object contract to show and control data from Salesforce by using custom business logic. You can create business objects by using the business object contract and datasource contract.

          Required Editions

          Available in: Enterprise, Performance, and Unlimited Editions

          A business object combines and contains data of a single business object from Salesforce, such as a product, an order, or a visit for use in the Consumer Goods Cloud offline mobile app. The data for a business object resides in database tables. You can access the data for business objects using the datasource contract. The data source attributes are mapped to the attributes of the corresponding business object.

          business_contracts_attributes_mapping

          Business objects contain these properties:

          • Simple Properties. The values of the simple properties come from the datasource used by the business object.
          • List Objects
          • Lookup Objects
          • Nested Objects

          A business object can also refer list objects. Each list object refers to its own datasource and contains a list of objects of the List Item type. In the Workflow module, for example, there are list objects and lookup objects in the business object (BO) container folder. The DS folder contains the datasource contracts corresponding to the business objects, list objects and lookup objects defined for the Workflow module. The Mv2 folder contains the method files for the BoWfeFlyoutNextStateByType business object.

          Methods

          All business objects have both standard methods and customized methods. The standard methods are automatically available to all objects. It’s possible to create, modify, or customize the methods for a business object.

          When you create a new business object, list object, or lookup object by using the sf modeler workspace add CLI command, the methods for the new object are created automatically. For example, LoadAsync and DoValidateAsync. LoadAsync loads the simple properties of an object from the database whereas ValidateAsync validates the consistency of an object before it’s saved. Other generated methods are CreateAsync, SaveAsync, and Initialize. You can explicitly activate or deactivate the automatic generation of load and create methods for an object using the generateLoadMethod and generateCreateMethod attributes in a business object declaration.

          To add method files to an existing business object, list object, or lookup object, you can manually copy the required template method files for the object from $workspace/contractSnippets. For example, the method files for a business object (BO) reside at $workspace/contractSnippets/BO_BusinessObject/businessobject/Bo${NAME}/Mv2.

          Business Objects, List Objects, and List Items

          Business objects, list objects, and list items are related. A list object consists of list items and a business object can consist of multiple list objects.

          Relation between BO, LI, and LO objects.
          Example
          Example This is the sample XML of the BoWfeFlyoutNextStateByType business contract:
          <BusinessObject name="BoWfeFlyoutNextStateByType" generateLoadMethod="true" generateCreateMethod="true" schemaVersion="1.1">
            <DataSource name="DsBoWfeFlyoutNextStateByType" />
            <SimpleProperties>
              <SimpleProperty name="pKey" type="DomPKey" />
              <SimpleProperty name="actualStatePKey" type="DomPKey" />
              <SimpleProperty name="nextStateCount" type="DomInteger" />
            </SimpleProperties>
            <NestedObjects>
              <NestedObject name="boWorkflow" objectClass="BoWorkflow" dataSourceProperty="pKey" nestingProperty="pKey" loadMode="LoadImmediate" />
            </NestedObjects>
            <ObjectLookups></ObjectLookups>
            <ListObjects>
              <ListObject name="nextStateList" objectClass="LoWfeState" dataSourceProperty="pKey" listProperty="wfeWorkflowPKey" loadMode="LoadImmediate" />
            </ListObjects>
            <Methods>
              <Method name="beforeSaveAsync" />
              <Method name="afterSaveAsync" />
              <Method name="afterLoadAsync" />
              <Method name="beforeLoadAsync" />
              <Method name="afterInitialize" />
              <Method name="beforeInitialize" />
              <Method name="afterDoValidateAsync" />
              <Method name="beforeDoValidateAsync" />
              <Method name="afterCreateAsync" />
              <Method name="beforeCreateAsync" />
              <Method name="loadAsync" />
              <Method name="createAsync" />
              <Method name="getStateTypeByState" />
              <Method name="getFirstNextStatePKey" />
            </Methods>
            <Validations></Validations>
          </BusinessObject>
          
           
          Loading
          Salesforce Help | Article