2011-06-01 38 views
0

獲得自動增加值我使用Sugar專業6,並檢查社區版相同。 在項目模塊,我有項目名稱應該從名爲MSO的前綴和自動遞增數量與另一場自動生成。糖CRM,在自定義字段

例如,

MSO代碼 - 的Xyz 項目名稱應該是─XYZ1

下一個記錄

MSO代碼 - ABCD 項目名稱應該是─ABCD1

MSO代碼 - 的Xyz 項目名稱應爲-Xyz2

回答

3

我肯定會使用項目模塊保存操作上的邏輯掛鉤。

  • 創建自定義/模塊/ 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'); 
    ?> 
    
  • 創建/自定義/模塊/ Mymodule中file.php/logic_hooks/

    <?php 
    class myClass{ 
        function myMethod(&$bean, $event, $arguments){ 
         // Do something with $bean (e.g. 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

+0

我想這將產生保存後,我需要的是用戶應該能夠看到生成的代碼在屏幕上之前點擊保存。是否可能,簡單的自動編號也有幫助,但是應該在保存前顯示在表單中。 – AjayR 2011-06-02 00:23:46

+0

感謝您的回覆,我使用AJAX實現了同樣的功能 – AjayR 2011-06-02 06:26:16

0

,如果你想生成自動遞增場只是添加在工作室簡單字段名唯一的ID,進入數據庫,並改變數值爲自動增量。

謝謝