User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:adminmanual:businessmappings:mapping [2016/07/19 19:01]
joebordes created
en:adminmanual:businessmappings:mapping [2020/08/06 23:31] (current)
joebordes [Rule Directive]
Line 1: Line 1:
 ====== (Field) Mapping Business Mapping ====== ====== (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. For example, when creating an Invoice from a SalesOrder or an Opportunity from a Contact.+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. 
 + 
 +<WRAP center round info 80%> 
 +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: <​code>​$(assigned_user_id : (Users) first_name)</​code>​ 
 +</​WRAP>​
  
 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. 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.
Line 9: Line 13:
  <​map>​  <​map>​
   <​originmodule>​   <​originmodule>​
-    <​originid>​22</​originid> ​ {optional} 
     <​originname>​SalesOrder</​originname>​     <​originname>​SalesOrder</​originname>​
   </​originmodule>​   </​originmodule>​
   <​targetmodule>​   <​targetmodule>​
-    <​targetid>​23</​targetid> ​ {optional} 
     <​targetname>​Invoice</​targetname>​     <​targetname>​Invoice</​targetname>​
   </​targetmodule>​   </​targetmodule>​
Line 19: Line 21:
     <​field>​     <​field>​
       <​fieldname>​subject</​fieldname> ​  ​{destination field on invoice}       <​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}       <​Orgfields> ​ {if more than one is present they will be concatenated with the delimiter}
         <​Orgfield>​         <​Orgfield>​
Line 35: Line 36:
         <​delimiter>;</​delimiter>​         <​delimiter>;</​delimiter>​
       </​Orgfields>​       </​Orgfields>​
 +      <​master>​true|false</​master>​ {optional: used for integration mapping between two systems}
     </​field>​     </​field>​
-    ​<​field>​ +     <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>​ 
 +        <​Orgfield>​ 
 +          <​OrgfieldName>​account_id</​OrgfieldName>​ 
 +          <​OrgfieldID>​RULE</​OrgfieldID>​ 
 +          <​Rule>​business rule name or ID</​Rule>​ 
 +        </​Orgfield>​ 
 +        <​delimiter>​ - </​delimiter>​ 
 +      </​Orgfields
 +    ​</​field>​ 
 +   <​field>​
       <​fieldname>​due_date</​fieldname> ​  ​{destination field on invoice}       <​fieldname>​due_date</​fieldname> ​  ​{destination field on invoice}
-      <​fieldID>​999</​fieldID> ​ {optional} 
       <​Orgfields>​       <​Orgfields>​
         <​Orgfield>​         <​Orgfield>​
Line 71: Line 94:
 <map> <map>
   <​originmodule>​   <​originmodule>​
-    <​originid>​4</​originid>​ 
     <​originname>​Contacts</​originname>​     <​originname>​Contacts</​originname>​
   </​originmodule>​   </​originmodule>​
   <​targetmodule>​   <​targetmodule>​
-    <​targetid>​2</​targetid>​ 
     <​targetname>​Potentials</​targetname>​     <​targetname>​Potentials</​targetname>​
   </​targetmodule>​   </​targetmodule>​
Line 179: Line 200:
 </​map>​ </​map>​
 </​code> ​ </​code> ​
-You can [[en:​adminmanual:​businessmappings:​contact2accounts|see an example of converting a Contact into an Account in the Business Mapping Store]].+You can [[en:​adminmanual:​businessmappings:store:​contact2accounts|see an example of converting a Contact into an Account in the Business Mapping Store]]. 
 + 
 +And there is an explanation and [[http://​discussions.corebos.org/​thread-338-post-1723.html#​pid1723|small example of Invoice default values here.]] 
 + 
 +Another [[http://​discussions.corebos.org/​thread-346-post-1772.html#​pid1772|example with Help Desk default values in the forum.]] 
 + 
 + 
 +===== Rule Directive ===== 
 + 
 +The rule directive will permit us to launch a [[en:​devel:​corebos_rules|coreBOS Business Rule]] and save the result in the field. This opens the possibilities to launch a query, a workflow expression or a decision table. 
 + 
 +You can accomplish the expression and template features with the Rule as it can do that and more. 
 + 
 +For example, we may be given a code that we have to search in another module to save a value that comes from there. In this case, we need to launch a query so we would set up a Business Map (Rule) of type Condition query with something like this: 
 + 
 +<code SQL> 
 +SELECT contactid  
 +FROM vtiger_contactdetails 
 +JOIN vtiger_contactscf on vtiger_contactdetails.contactid = vtiger_contactscf.contactid 
 +where cf_1518=? 
 +</​code>​ 
 + 
 +Let's suppose we called this business map "​getContactFromSeller",​ then we would add the directive:​ 
 + 
 +<code XML> 
 +<​Orgfield>​ 
 +  <​OrgfieldName>​contact_id</​OrgfieldName>​ 
 +  <​OrgfieldID>​RULE</​OrgfieldID>​ 
 +  <​Rule>​getContactFromSeller</​Rule>​ 
 +</​Orgfield>​ 
 +</​code>​ 
 + 
 + 
 +===== Accessing via web service ===== 
 + 
 +This type of map can be processed using the **ProcessMap** end-point