Loading...
 

The accepted format is:

<map>
  <originmodule>
    <originid>22</originid> {optional}
    <originname>SalesOrder</originname>
  </originmodule>
  <listview>
  <c>1</c>  Add button
  <r>1</r>  View record
  <u>1</u>  Edit action
  <d>1</d>  Delete action
  {conditiongroup}  Optional
  </listview>
  <detailview>
  <c>1</c>  Duplicate button
  <r>1</r>  View record
  <u>1</u> Edit action
  <d>v1</d>  Delete action
  {conditiongroup}  Optional
  </detailview>
  <relatedlists>
    <relatedlist>
      <modulename>Invoice</modulename>
      <c>1</c> Add button
      <r>1</r>  View list
      <u>1</u> Edit action
      <d>1</d> Delete action
      <s>1</s> Select button
      {conditiongroup}  Optional
    </relatedlist>
    .....
  </relatedlists>
  </map>

 

where {condtiongroup} is

<condition>
   <businessrule>{cbMapID}</businessrule>
   <c>1</c>  Add button
   <r>1</r>  View list
   <u>1</u> Edit action
   <d>1</d>  Delete action
   <s>1</s>  Select button
</condition>

 

and the business rule must be of type ConditionQuery or ConditionExpression and return a number bigger than zero, a boolean true, the string 'true' or the string 'yes' to be accepted. Any other value will be false.

If the condition is a ConditionQuery, the SQL will be executed with only one parameter, which is the CRMID of the Record launching the Record Access Control, if it is a ConditionExpression it will be executed with the full set of fields of the Record launching the Record Access Control. The CRUDS settings contained inside the will override the default settings if the condition is true.

Business Mapping is tied with the workflow system. Through the workflow system, you can assign conditions for the mapping to be applied. For example, we can easily block the editing and deleting of a project task depending on the status of its parent project. That would look like this. First, a workflow and business mapping to block the projects that are closed:

 

3FZKGFeb5Vh0kHMqZrIeYZGd1Io-BID2PfQ_zdZfo9bVGeQ3vrJGk4YTBGTmekQv4DoSzDjEtCxOF1ChnDVQWR5FZslBCborUteX_a5Mmy2ijIZOhqHzo-bJbndl5HC0Wu5VQxrH

 

Next a workflow and mapping to block the project tasks:

 

ZAS0mGwAQIvxuYe9zZcz91NnbMWjoPncoHWecQWwCZMnmQ-mZOjyrm3rxfuqGrfRKcD4Xrgi_Edr5K-DEkUdcD0EyHmaWGC1GU5Kk3rybP0Y2MuLNRUhVJk06OHDRcx9Oe7FdftD

 

You could easily add another condition to the workflows so that they applied only for certain users (for example).

Condition Query Example

As an example of the use of a condition query, we could add a rule whereas we permit adding ProjectTask to a Closed Project if the related Account has at least one potential record associated:

<relatedlists>
    <relatedlist>
      <modulename>ProjectTask</modulename>
      <c>0</c>
      <r>1</r> 
      <u>1</u>
      <d>0</d>
      <s>0</s>
<condition>
<businessrule>27183</businessrule>
      <c>1</c>
      <r>0</r> 
      <u>0</u>
      <d>1</d>
      <s>1</s>
</condition>
    </relatedlist>
    <relatedlist>
      <modulename>ProjectMilestone</modulename>
      <c>0</c>
      <r>1</r> 
      <u>0</u>
      <d>0</d>
      <s>0</s>
    </relatedlist>
  </relatedlists>

 

where the business rule with crmid=27183 is of type conditionquery and contains:

<map>
<sql>SELECT count(*) as numpots
FROM vtiger_potential
INNER JOIN vtiger_account on vtiger_potential.related_to = vtiger_account.accountid
INNER JOIN vtiger_project on vtiger_project.linktoaccountscontacts = vtiger_account.accountid
INNER JOIN vtiger_crmentity ce ON ce.crmid=vtiger_potential.potentialid
WHERE ce.deleted=0 AND vtiger_project.projectid =?
</sql>
<return>numpots</return>
</map>

 

Block Sent Emails Delete and Edit Example

Another example is to block editing and deleting of sent emails on the list view, which would be something like this:

 

QWuqxJxbUqBxmwzMUPuL87ZZlhN5KByBzzmreaqcLLFEozLz7k_6l4LXyMeqtibWUl-lN2c0SUZoYw1tMfns29bhxKSVlKOsQfugHqTHCwe_INDGRb3PHdN7IjDkS1dZ_Z7gK55c

 

with this mapping:

 

<map>
  <originmodule>
    <originname>Emails</originname>
  </originmodule>
    <listview>
  <u>0</u>
  <d>0</d>
    </listview>
  </map>

 

Admin Manual
Developer Manual