User Tools


Differences

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

Link to this comparison view

Both sides previous revision Previous revision
en:adminmanual:businessmappings:mapping [2019/08/12 15:36]
joebordes
en:adminmanual:businessmappings:mapping [2019/08/12 15:46] (current)
joebordes
Line 205: Line 205:
  
 Another [[http://​discussions.corebos.org/​thread-346-post-1772.html#​pid1772|example with Help Desk default values in the forum.]] 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>​
 +
 +
 +