This is an old revision of the document!


(Field) Mapping Business Mapping

This business rule serves the purpose of filling in fields of a new record when coming from another module's record or setting default values for the module you are creating. For example, when creating an Invoice from a SalesOrder or an Opportunity from a Contact.

When creating a new record you always have access to all the fields of the current user using the FIELD or TEMPLATE types. For example:

$(assigned_user_id : (Users) first_name)

It will permit you to define what values you want to copy from the origin module or simply what values you want to set by default when creating in the way.

The accepted format is:

 <map>
  <originmodule>
    <originid>22</originid>  {optional}
    <originname>SalesOrder</originname>
  </originmodule>
  <targetmodule>
    <targetid>23</targetid>  {optional}
    <targetname>Invoice</targetname>
  </targetmodule>
  <fields>
    <field>
      <fieldname>subject</fieldname>   {destination field on invoice}
      <fieldID>999</fieldID>  {optional}
      <Orgfields>  {if more than one is present they will be concatenated with the delimiter}
        <Orgfield>
          <OrgfieldName>subject</OrgfieldName>
          <OrgfieldID>634</OrgfieldID>
        </Orgfield>
        <Orgfield>
          <OrgfieldName>sostatus</OrgfieldName>
          <OrgfieldID>778</OrgfieldID>
        </Orgfield>
        <Orgfield>
          <OrgfieldName>_FromSO</OrgfieldName>  {this is a constant string}
          <OrgfieldID>CONST</OrgfieldID>
        </Orgfield>
        <delimiter>;</delimiter>
      </Orgfields>
    </field>
     <field>
      <fieldname>description</fieldname>   {destination field on invoice}
      <Orgfields>  {if more than one is present they will be concatenated with the delimiter}
        <Orgfield>
          <OrgfieldName>$(assigned_user_id : (Users) first_name)</OrgfieldName>
          <OrgfieldID>FIELD</OrgfieldID>
        </Orgfield>
        <Orgfield>
          <OrgfieldName>$(assigned_user_id : (Users) last_name)</OrgfieldName>
          <OrgfieldID>FIELD</OrgfieldID>
        </Orgfield>
        <Orgfield>
          <OrgfieldName>The user assigned to the Sales Order is: $(assigned_user_id : (Users) first_name) $(assigned_user_id : (Users) last_name)</OrgfieldName>  {this is a constant string}
          <OrgfieldID>TEMPLATE</OrgfieldID>
        </Orgfield>
        <delimiter> - </delimiter>
      </Orgfields>
    </field>
   <field>
      <fieldname>due_date</fieldname>   {destination field on invoice}
      <fieldID>999</fieldID>  {optional}
      <Orgfields>
        <Orgfield>
          <OrgfieldName>add_days(get_date('today'), 30)</OrgfieldName>
          <OrgfieldID>EXPRESSION</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field>
    <field>
     .....
    </field>
  </fields>
  </map>

The name of the mapping must follow a specific format which is

{OriginModule}2{TargetModule}

you must create the mapping exactly with that name and the module names must be exactly their internal module name. If you want to have more than one mapping that will be applied depending on the user you must also create a new entry in the Global Variable name picklist called

BusinessMapping_{OriginModule}2{TargetModule}

and then define a Global Variable of this type and select the corresponding Business Mapping.

For example, if you create a Mapping called Contacts2Potentials and set it's mapping to the one below, you will get the name set to the contact's name, the closing date set to 30 days from now and the sales stage set to Qualifying.

Then call the create page of Potentials from a link passing in the variable cbfromid or from a related list, which already has this variable.

<map>
  <originmodule>
    <originid>4</originid>
    <originname>Contacts</originname>
  </originmodule>
  <targetmodule>
    <targetid>2</targetid>
    <targetname>Potentials</targetname>
  </targetmodule>
  <fields>
    <field>
      <fieldname>potentialname</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>firstname</OrgfieldName>
        </Orgfield>
        <Orgfield>
          <OrgfieldName>lastname</OrgfieldName>
        </Orgfield>
        <delimiter> </delimiter>
      </Orgfields>
    </field>
    <field>
      <fieldname>closingdate</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>add_days(get_date('today'), 30)</OrgfieldName>
          <OrgfieldID>expression</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field>
    <field>
        <fieldname>sales_stage</fieldname>
        <Orgfields>
            <Orgfield>
                <OrgfieldName>Qualification</OrgfieldName>
                <OrgfieldID>CONST</OrgfieldID>
            </Orgfield>
        </Orgfields>
    </field>
  </fields>
</map>

Another example for User default values:

<map>
  <originmodule>
    <originname>Users</originname>
  </originmodule>
  <targetmodule>
    <targetname>Users</targetname>
  </targetmodule>
  <fields>
    <field>
      <fieldname>currency_grouping_pattern</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>123456789</OrgfieldName>
          <OrgfieldID>CONST</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field>
    <field>
      <fieldname>currency_decimal_separator</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>.</OrgfieldName>
          <OrgfieldID>CONST</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field>
    <field>
      <fieldname>QLTQ</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>QLTQ</OrgfieldName>
          <OrgfieldID>CONST</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field>
    <field>
      <fieldname>ALVT</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>ALVT</OrgfieldName>
          <OrgfieldID>CONST</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field> 
    <field>
      <fieldname>tagcloudview</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>false</OrgfieldName>
          <OrgfieldID>CONST</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field>
    <field>
      <fieldname>showtagas</fieldname>
      <Orgfields>
        <Orgfield>
          <OrgfieldName>vring</OrgfieldName>
          <OrgfieldID>CONST</OrgfieldID>
        </Orgfield>
      </Orgfields>
    </field>
</fields>
</map>

You can see an example of converting a Contact into an Account in the Business Mapping Store.

And there is an explanation and small example of Invoice default values here.

Another example with Help Desk default values in the forum.


coreBOS Documentación