kintone ドライバー V24 新機能の紹介

by 松本勝成 | 2024年07月29日

Title

本記事では、CData kintone Drivers のV24 で追加されたテーブルやビューの紹介とその応用例として、kintone アプリの項目を更新したり、kintone アプリを作成する例についてご紹介します。

新しく追加されたテーブルとビュー

  1. フォームに関するもの

    1. FormFields

      AppId で指定したkintone アプリのフィールド情報を取得することができます。
      SELECT * FROM [FormFields] WHERE [AppId]=67;
      FormFields
    2. FormLayout

      AppId で指定したkintone アプリのフィールドのレイアウト情報を取得することができます。
      SELECT * FROM [FormLayout] WHERE [AppId]=67;
      FormLayout
    3. ProcessManagement

      AppId で指定したkintone アプリのプロセス管理情報を取得することができます。
      SELECT * FROM [ProcessManagement] WHERE [AppId]=67;
      ProcessManagement
  2. 権限に関するもの

    1. AppPermissions

      AppId で指定したkintone アプリのアプリアクセス権限情報を取得することができます。
      SELECT * FROM [AppPermissions] WHERE [AppId]=67;
      AppPermissins
    2. RecordPermissions

      AppId で指定したkintone アプリのレコードアクセス権限情報を取得することができます。
      SELECT * FROM [RecordPermissions] WHERE [AppId]=67;
      RecordPermissions
    3. FieldPermissions

      AppId で指定したkintone アプリのフィールドアクセス権限情報を取得することができます。
      SELECT * FROM [FieldPermissions] WHERE [AppId]=67;
      FieldPermissions
  3. 通知に関するもの

    1. GeneralNotifications

      AppId で指定したkintone アプリのアプリの条件通知情報を取得することができます。
      SELECT * FROM [GeneralNotifications] WHERE [AppId]=67;
      PerRecordNotifications
    2. PerRecordNotifications

      AppId で指定したkintone アプリのレコードの条件通知情報を取得することができます。
      PerRecordNotificationsTargetsでは、通知先を取得することができます。
      SELECT * FROM [PerRecordNotifications] WHERE [AppId]=67;
      PerRecordNorifications
      SELECT * FROM [PerRecordNotificationsTargets] WHERE [AppId]=67;
      PerRecordNotificationsTargets
    3. ReminderNotifications

      AppId で指定したkintone アプリのリマインダーの条件通知情報を取得することができます。
      ReminderNotificationsTargetsでは、通知先を取得することができます。
      SELECT * FROM [ReminderNotifications] WHERE [AppId]=67;
      ReminderNotifications
      SELECT * FROM [ReminderNotificationsTargets] WHERE [AppId]=67;
      ReminderNotificationsTargets
  4. 設定に関するもの

    1. GeneralSettings

      AppId で指定したkintone アプリの「アイコンと説明」および、「デザインテーマ」の設定情報を取得することができます。
      SELECT * FROM [GeneralSettings] WHERE [AppId]=67;
      GeneralSettings
    2. ActionSettings

      AppId で指定したkintone アプリの「アクション」の設定情報を取得することができます。
      ActionSettingsEntitiesとActionSettingsMappingsは、それぞれActionSettingsのEntities、Mappingsカラムの値をテーブルとして取得することができます。
      SELECT * FROM [ActionSettings] WHERE [AppId]=67;
      ActionSettings
      SELECT * FROM [ActionSettingsEntities] WHERE [AppId]=67;
      ActionSettingsEntities
      SELECT * FROM [ActionSettingsMappings] WHERE [AppId]=67;
      ReminderNotificationsTargets
    3. GraphSettings

      AppId で指定したkintone アプリの「グラフ」設定情報を取得することができます。
      SELECT * FROM [GraphSettings] WHERE [AppId]=67;
      GraphSettings

応用例

これらの新しく追加されたテーブルを使うことで、ドライバーからkintone アプリを作成したり、CData Driver を使って、kintone アプリのメンテナンスを行うことができます。

変更時は、Web ページで変更を行った後、「アプリを更新」で変更内容を確定するのと同様に、DeployApps で変更内容をデプロイします。

  1. ドロップダウンフィールドに項目を追加する

    次のSQL でkintone アプリ内のドロップダウンフィールドにある項目を更新することができます。
    この仕組みを使うと、社内システムのデータベースなどとkintone アプリの項目を連携させることができます。

    -- 1) ドロップダウンフィールドの項目に更新します
    UPDATE [FormFields] SET [Properties]='{"ドロップダウン": {
    "type": "DROP_DOWN",
    "code": "ドロップダウン",
    "label": "ドロップダウン",
    "noLabel": false,
    "required": false,
    "options": {
    "sample1": {"label": "sample1","index": "0"},
    "sample2": {"label": "sample2","index": "1"},
    "sample3": {"label": "sample3","index": "2"}
    },
    "defaultValue": ""}}' WHERE [AppId]=67;
    
    -- 2) 変更内容をデプロイします
    EXEC DeployApps @AppId=67;

    Properties に指定する文字列は、下記URLで確認することができます。
    フィールドを取得する - cybozu developer network

  2. kintone ドライバーからkintone アプリを作成する

    下記のようなSQL を実行することで、kintone ドライバーからお問い合わせ情報を管理するkintone アプリを作成することができます。
    -- 1) アプリを作成します
    EXEC CreateApp @Name='お問い合わせ情報';
    作成するとAppId が取得できるので、このAppId に対してフィールドを追加してkintone アプリを作成してきます。
    
    -- 2) フィールドを追加します
    INSERT INTO FormFields (AppId, Type, Code, Label, Required) VALUES (145, 'SINGLE_LINE_TEXT', 'お名前', 'お名前', True);
    INSERT INTO FormFields (AppId, Type, Code, Label, Required) VALUES (145, 'SINGLE_LINE_TEXT', '会社名', '会社名', False);
    INSERT INTO FormFields (AppId, Type, Code, Label, Required) VALUES (145, 'SINGLE_LINE_TEXT', '勤務先Eメールアドレス', '勤務先Eメールアドレス' True);
    INSERT INTO FormFields (AppId, Properties) VALUES (145, '{
    "サポートタイプ": {
    "type": "DROP_DOWN",
    "code": "サポートタイプ",
    "label": "サポートタイプ",
    "noLabel": false,
    "required": true,
    "options": {"評価版": {"label": "評価版","index": "0"},"スタンダード": {"label": "スタンダード","index": "1"}},
    "defaultValue": "評価版"
    }}');
    INSERT INTO FormFields (AppId, Type, Code, Label, Required) VALUES (145, 'SINGLE_LINE_TEXT', 'プロダクトキー', 'プロダクトキー', False);
    INSERT INTO FormFields (AppId, Properties) VALUES (145, '{
    "ご利用のCData製品を教えてください": {
    "type": "RADIO_BUTTON",
    "code": "ご利用のCData製品を教えてください",
    "label": "ご利用のCData 製品を 教えてください",
    "required": true,
    "options": {
    "ADO.NET": {"label": "ADO.NET","index": "0"},
    "Excel Add-In": {"label": "Excel Add-In","index": "1"},
    "JDBC": {"label": "JDBC","index": "2"},
    "API Server": {"label": "API Server","index": "9"},
    "ODBC": {"label": "ODBC","index": "3"},
    "SSIS": {"label": "SSIS","index": "4"},
    "FireDAC": {"label": "FireDAC","index": "5"},
    "Python": {"label": "Python","index": "6"},
    "Power BI Connector": {"label": "Power BI Connector","index": "7"},
    "Tableau Connector": {"label": "Tableau Connector","index": "8"},
    "DBAmp": {"label": "DBAmp","index": "11"},
    "Connect Cloud": {"label": "Connect Cloud","index": "10"},
    "Arc": {"label": "Arc","index": "12"},
    "Connect Server": {"label": "Connect Server","index": "13"},
    "Sync": {"label": "Sync","index": "14"},
    "Virtuality": {"label": "Virtuality","index": "15"}
    },
    "defaultValue": "Excel Add-In",
    "align": "HORIZONTAL"
    }}');
    INSERT INTO FormFields (AppId, Properties) VALUES (145, '{
    "お客様のソリューションが稼働している環境を教えてください": {
    "type": "RADIO_BUTTON",
    "code": "お客様のソリューションが稼働している環境を教えてください",
    "label": "お客様のソリューションが稼働している環境を教えてください。",
    "noLabel": false,
    "required": true,
    "options": {
    "Windows": {"label": "Windows","index": "0"},
    "Unix/Linux": {"label": "Unix/Linux","index": "1"},
    "macOS": {"label": "macOS","index": "2"},
    "クラウド環境(AWS)": {"label": "クラウド環境(AWS)","index": "3"},
    "その他 / 不明": {"label": "その他 / 不明","index": "4"}
    },
    "defaultValue": "Windows",
    "align": "HORIZONTAL"
    }}');
    INSERT INTO FormFields (AppId, Type, Code, Label, Required) VALUES (145, 'SINGLE_LINE_TEXT', 'サポート依頼内容を1行程度で簡単にご記入ください', 'サポート依頼内容を、1行程度で簡単にご記入ください。', True);
    INSERT INTO FormFields (AppId, Type, Code, Label, Required) VALUES (145, 'SINGLE_LINE_TEXT', 'サポート依頼内容の詳細をご記入ください', 'サポート依頼内容の詳細をご記入ください。、1行程度で簡単にご記入ください。', True);
    
    -- 3) アプリをデプロイします
    EXEC DeployApps @AppId=145;

    作成された「お問い合わせ情報」アプリ
    作成された「お問い合わせ情報」アプリ

まとめ

V24 では、kintone アプリ内のデータだけでなく、kintone アプリ自体に関する情報にもCData ドライバーからアクセスできるようになり、kintone アプリと様々なシステムを、より柔軟に連携することができるようになりました。
今回追加された機能は、特に普段からkintone アプリを活用している方にとってメリットが多い機能となっていますので、ぜひ一度、CData Kintone ドライバーをお試しください。

関連コンテンツ

トライアル・お問い合わせ

30日間無償トライアルで、CData のリアルタイムデータ連携をフルにお試しいただけます。記事や製品についてのご質問があればお気軽にお問い合わせください。