カスタムフィールドを追加する手順とコードの例は次のとおりです。
次のコードをカスタム/拡張機能/モジュール/会議/ext/vardefs/new_field.phpに追加します:
<?php
$dictionary['Meeting']['fields']['custom_field'] = array(
'name' => 'custom_field',
'label' => 'カスタムフィールド',
'vname' => 'LBL_CUSTOM_FIELD',
'type' => 'varchar',
'len' => '255',
'default' => '',
'massupdate' => 0,
'no_default' => false,
'comments' => '',
'help' => '',
'importable' => 'true',
'required' => false,
'reportable' => true,
'audited' => false,
'duplicate_merge' => 'enabled',
'duplicate_merge_dom_value' => '1',
'merge_filter' => 'disabled',
'unified_search' => false,
'calculated' => false,
'full_text_search' => array(
'enabled' => true,
'boost' => 0.5,
'searchable' => true,
),
);
次のコマンドを実行してメタデータを更新します。
php -f bin/sugarcrm repair
SuiteCRMの背景にログインし、「レイアウト管理」に「スケジュール管理」を入力し、新しいフィールドをレイアウトビューにドラッグして使用を開始します。
以下は、フックメカニズムを介したカスタムリマインダーロジックです。
次のコードをカスタム/モジュール/会議/logic_hooks.phpファイルに追加します。
<?php
$hook_version = 1;
$hook_array = array();
$hook_array['before_save'][] = array(
10,
'reminder',
'custom/modules/Meetings/reminder.php',
'reminder',
'beforeSave',
);
カスタム/モジュール/会議/reminder.phpファイルを作成し、次のロジックを書きます。
<?php
class reminder
{
function beforeSave($bean, $event, $arguments)
{
$before_save_custom_field = $bean->custom_field;
// サンプルリマインダーロジック,ファイルをログに記述します
file_put_contents('reminder.log', $before_save_custom_field . "\n", FILE_APPEND);
// 要件に応じて電子メールを送信するように拡張できます、SMSなど
}
}
この関数は、スケジュールを保存する前にトリガーされ、ログを記録したり、通知をプッシュしたりするために使用して、チームメンバーがタイムリーにアレンジメントを通知できるようにすることができます。