CoreBOSBB
How to carry an account to timecontrol from a projecttask - Printable Version

+- CoreBOSBB (https://discussions.corebos.org)
+-- Forum: Support (https://discussions.corebos.org/forumdisplay.php?fid=17)
+--- Forum: Administrator Support (https://discussions.corebos.org/forumdisplay.php?fid=8)
+--- Thread: How to carry an account to timecontrol from a projecttask (/showthread.php?tid=1177)



How to carry an account to timecontrol from a projecttask - Guido1982 - 07-24-2018

Lets say you use timecontrol to keep track of the time spent on projects. You create timecontrol records from the project tasks, but you also want to carry over the account on the project to the timecontrol record, even though the projecttask is not directly related to the account.

You'd need the following business map (adjust to fit you exact needs)
Code:
<map>
<originmodule>
<originid>49</originid>
<originname>ProjectTask</originname>
</originmodule>
<targetmodule>
<targetid>56</targetid> <!-- Make sure this is correct or remove al together -->
<targetname>Timecontrol</targetname>
</targetmodule>
<fields>
<field>
<fieldname>cf_722</fieldname> <!-- The field on timecontrol you want to fill -->
  <Orgfields>
     <Orgfield>
          <OrgfieldName>$(projectid : (Project) linktoaccountscontacts)</OrgfieldName>
          <OrgfieldID>EXPRESSION</OrgfieldID>
      </Orgfield>
</Orgfields>
</field>
</fields>
</map>

The magic is in the '$(projectid : (Project) linktoaccountscontacts)' part. It gets the 'projectid' field from the project task, searches in Projects, and returns the result from the field 'linktoaccountscontacts'. Be careful when you link a project to a contact and carry it over to a UI10 field that is only meant for accounts!