簡體   English   中英

Sugar CRM,在自定義字段中獲取自動增量值

[英]Sugar CRM, Getting auto increment value in the custom field

我正在使用 Sugar Professional 6 並在社區版本中檢查相同的內容。 在項目模塊中,我有項目名稱,它應該從另一個名為 MSO 的字段自動生成,帶有前綴和自動增量編號。

例如。

MSO 代碼 - Xyz項目名稱應為 - Xyz1

為下一個記錄

MSO 代碼 - Abcd項目名稱應為 - Abcd1

MSO 代碼 - Xyz項目名稱應為 - Xyz2

我肯定會在項目模塊保存操作上使用邏輯鈎子來實現它。

  • 在 custom/modules/ myModule / 中創建一個 logic_hooks.php

     <? $hook_array = Array(); $hook_array['after_save'] = Array(); $hook_array['after_save'][] = Array(0, 'myName', 'custom/modules/myModule/logic_hooks/file.php','myClass', 'myMethod'); ?>
  • 在 /custom/modules/ myModule /logic_hooks/ 中創建文件.php

     <?php class myClass{ function myMethod(&$bean, $event, $arguments){ // Do something with $bean (eg load the MSO code and calculate the project name, and afterwards set the project name to the found value.) } }?>

有關詳細信息,請參閱: http://developers.sugarcrm.com/docs/OS/6.1/-docs-Developer_Guides-Sugar_Developer_Guide_6.1.0-Chapter%204%20Customizing%20Sugar.html#9000530

如果要生成自動增量字段,只需在工作室中添加簡單的字段名稱唯一 id 並在數據庫中添加 go 並將值更改為自動增量。

謝謝

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM