![]() |
リクエストは通常、複数のサードパーティ製アプリケーションによるタスクの完了を必要とします。 例: Active Directoryアカウントの作成、問題トラッカーの統合、新規メールアカウントの作成など このようなリクエストに対応するために、技術担当者はそれぞれのサードパーティ製アプリケーションにアクセスして各タスクを処理する必要があります。 これまでの処理手順はこのようなものでした。 このような煩雑な処理に対応するため、外部アクションプラグインを使用し、技術担当者によるさまざまなサードパーティ製アプリケーションにおけるアクションを、リクエストテンプレートからクリックひとつで実行できる機能を導入することができます。外部アクションプラグインは、リクエストを処理するために必要となるさまざまなサードパーティ製アプリケーションとの接続を目的としています。接続には、サードパーティ製アプリケーションが必要とする情報が埋め込まれたXMLコードを使用します。

ServiceDesk Plusとサードパーティ製アプリケーションを統合するには、以下の場所にあるRequest_ActionMenu.xmlを修正する必要があります。 [SDP Home]/server/default/conf
|
メモ
|
1. リクエストの詳細ページより、アクションメニューを使用してサードパーティ製アプリケーションに接続することができます。 2. 外部アクションプラグインを通じ、必要に応じてアクションメニューをカスタマイズすることができます。 |
ServiceDesk Plusとサードパーティ製アプリケーションを統合するためのスケルトンコード(ダミー属性を含む):
<menus>
<menu name="Add Jira Ticket" refresh="true">
<displaytext>Create a JIRA ticket</displaytext>
<roles>
<role>SDAdmin</role>
</roles>
<template>
<template>Default Request</template>
</templates>
<invoke>
<class>com.manageengine.servicedesk.actionplugin.sample.JIRAIntegration</class>
</invoke>
</menu>
</menus>
上記コードは問題追跡ソフトウェアJIRAとServiceDesk Plusを、アクションメニューに追加された 'Add Jira Ticket' メニューオプションを通じて統合します。 com.manageengine.servicedesk.actionplugin.sample.JIRAIntegration が JIRAIntegration クラス をコールし、この操作を実現しています。
メモ
|
1. 上記コードのJIRA統合クラス(デフォルトでServiceDesk Plusの一部)はServiceDesk Plusとの統合のために実行されます。 2. チケット(リクエスト)を処理するため、作成時に「誰がアクセスするか」と、「どのテンプレートを使用するか」を決定する必要があります。 これは、<roles>と<template>タグを使用して実現します。 |
コード上で使用されているタグとその用途の一覧
|
タグ |
説明 |
例 |
|
アクションメニュー上に作成するすべてのメニューを含む。すべてのメニューのルートに提供。 |
<menus></menus> |
|
アクションメニューに作成された個別のメニュー - 一意の"name"属性を使用してそれぞれを識別 |
<menu>JIRA統合</menu> <menu>SDP統合</menu> |
|
UIに表示するテキストの設定。国際化されたフォーマットを使用可能(例:"sdp.action.createticket")。ただしこの場合、"custom/i18n"に適切な*.propertiesファイルが必要。 |
<displaytext>SCP から Jira の統合</displaytext> <displaytext>SCP から SDP の統合</displaytext> |
|
外部アクションプラグインで設定したアクションメニューを表示/アクセスするためのすべての役割(アクセス許可) |
<roles></roles> |
|
外部アクションプラグインで設定したアクションメニューを表示/アクセスするためのすべての役割(アクセス許可)を作成 |
<role>SDADMIN</role> <role>SDGUEST</role> |
|
リクエストに関連付けられたさまざまなテンプレート。すべてのテンプレートを使用する場合、このタグは必須ではない |
<templates></templates> |
|
リクエストに関連付けられた一意のテンプレートの参照(インシデントテンプレート、返信テンプレートなど) |
<template>default template</template> <template>system defined template</template> |
|
必要なアクションを起動するタグ(リクエストをIDにタグ付ける、など) |
<invoke></invoke> |
|
必要なアクションを用意するためのクラスの参照 |
<class>JiraActionImplementation</class> |
DefaultActionInterfaceを拡張してSDP(アクションメニュー)のカスタマイズすることにより、サードパーティ製アプリケーションのリクエスト関連の操作を統合できます。
メモ
|
1. DefaultActionInterface はエンティティ上の外部アクションの実行を許可するインタフェースです(このケースの場合、アクションメニュー) 2. ActionInterfaceクラスの実装は.xmlファイルに指定する必要があります。 |
DefaultActionInterfaceの拡張:
package com.manageengine.servicedesk.actionplugin.sample; import com.manageengine.servicedesk.actionplugin.executor.ActionInterface import com.manageengine.servicedesk.actionplugin.executor.ExecutorData public class JIRAIntegration extends DefaultActionInterface { public JSONObject execute(ExecutorData executorData) throws Exception { } }
|
ExecutorDataで使用できるメソッド:
Package: com.manageengine.servicedesk.actionplugin.executor.ExecutorData
a. getActionMenuData( )
|
Parameter |
Return Value |
Action |
|
String |
アクションメニューの名前を取得 |
|
String |
アクションメニューの表示名を取得 |
|
String |
設定された実装クラスを取得 |
|
Boolean |
ページを参照するかどうかに関連する情報を取得 |
|
Array |
許可された役割に関する情報を取得(設定されていない場合は空白) |
|
Array |
許可されたテンプレートに関する情報を取得(設定されていない場合は空白) |
b.getDataJSON( )
起動されたメニューのリクエストのJSONObjectを返す サンプルデータ: { "WORKORDERID":"4", "REQUESTER":"Guest", "CREATEDBY":"administrator", "DUEBYTIME":"-1", "RESPONSEDUEBYTIME":"-1", "CREATEDBY":"administrator", "FR_DUETIME":"-1", "RESPONDEDTIME":"0", "RESOLVEDTIME":"0", "COMPLETEDTIME":"0", "SHORTDESCRIPTION":"The printer is not working from the machines that are in the 10th floort", "TIMESPENTONREQ":"0hrs 0min", "SUBJECT":"Printer not working", "REQUESTTEMPLATE":"Default Request", "MODE":" ", "SLA":" ", "ASSET":" ", "DEPARTMENT":" ", "SITE":" ", "CATEGORY":" ", "SUBCATEGORY":" ", "ITEM":" ", "TECHNICIAN":" ", STATUS":"Open", "PRIORITY":" ", "LEVEL":" ", "IMPACT":" ", "URGENCY":" ", "IMPACTDETAILS":" ", "REQUESTYPE":" ", "CLOSURECODE":" ", "CLOSURECOMMENTS":" ", "GROUP":" ", }
|
この情報により、顧客は必要な操作を実行するために独自の実装コードを記述することができます。 チケットを更新するためには2通りの方法があります。 1つ目のオプションは、SDPがサポートするREST APIを使用し、リクエストを更新するか、作業ログ、メモ、回答などの操作を実行する方法です。2つ目のオプションは、アクションプラグインのフレームワークがサポートするデフォルトのreturn機能を使う方法です。
実行メソッドはJSONオブジェクトを返します。 デフォルトでは、結果のJSONがサポートされるフォーマットに適合する場合、メモの追加とリクエストの更新が可能です。
a. リクエストにメモを追加する:
{ "message":"Request Added Successfully", "result":"success", "operation":[ { "INPUT_DATA": [ { "notes": { "notestext":"Tickethas been created in JIRA and information populated in SDP" } }], "OPERATIONNAME":"ADD_NOTE" }], }
|
b. リクエストの更新
{ "message":"Request Added Successfully", "result":"success", "operation":[ { "INPUT_DATA": [ { "Jira ID":"35", "Jira Key":"SDP-3", "self":"http://jira-server/rest/api/2/issue/35" }], "OPERATIONNAME":"UPDATE_REQUEST" }], }
|
リクエストアクションメニューの設定用
<?xml version="1.0" encoding="UTF-8"?>
<menus>
<menu name=""JiraIntegration"" refresh="true">
<displaytext>SCP to Jira Integration</displaytext>
<roles>
<role>ModifyRequests</role>
</roles>
<template>
<template>System Defined Template</template>
</templates>
<invoke>
<class>com.manageengine.supportcenter.integrations.jira.action.JiraActionImplementation</class>
</invoke>
</menu>
<menu name=""SDP Integration"" refresh="true">
<displaytext>SCP to SDP Integration</displaytext>
<roles>
<role>ModifyRequests</role>
</roles>
<templates>
<template>System Defined Template</template>
<template>testing</template>
</templates>
<invoke>
<class>com.manageengine.supportcenter.integrations.jira.action.SDPActionImplementation</class>
</invoke>
</menu>
</menus>
JIRA実装用
メモ: JIRAの実装をデフォルトで提供します。 JIRA特有の実装を持つ顧客は別のXMLを定義する必要があります。
<?xml version="1.0" encoding="UTF-8"?> <menus> <!-- The menu name should match the one specified in the ActionMenu xml --> <menu name="JiraIntegration"> <--Specifies the input parameters that should be passed to JIRA--> <request> <!-- Credentials need to login to JIRA --> <username>administrator</username> <password>administrator</password> <!-- URL to invoke to perform the operation --> <url>http://seshadri-0040:8080/rest/api/2/issue/</url> <!-- Params to be passed to the URL --> <param> <name>project</name> <type>projectpicker</type> <value>SCP</value> </param> <param> <name>Issuetype</name> <type>select</type> <value>Bug</value> <!-- Dynamic parameters can be specified by a $ prefix. このケースの場合、変数の値はSDPから取得され、渡されます。 -->
</param> <param> <name>summary</name> <type>textfield</type> <value>$subject</value> <param> <name>priority</name> <type>select</type> <value>$priority</value> </param> <param> <name>description</name> <type>textarea</type> <value>$description</value> </param> <param> <name>labels</name> <type>labels</type> <value>$JIRA_ISSUE_ID</value> </param> <param> <name>environment</name> <type>textarea</type> <value>$description</value> </param> <param> <name>duedate</name> <type>datepicker</type> <value>$dueByTime</value> </param> <param> <name>customfield_10002</name> <type>url</type> <value>$Company Website</value> </param> <param> <name>customfield_10100</name> <type>url</type> <value>$JIRA_SelectList</value> </param> <param> <name>customfield_10200</name> <type>float</type> <value>$Jira Numeric Field</value> <param> <name>customfield_10300</name> <type>textfield</type> <value>$Jira_Text Field</value> </param> <param> <name>customfield_10301</name> <type>datetime</type> <value>$Jira_Date Time</value> </param> <param> <name>customfield_10302</name> <type>datepicker</type> <value>$Jira_Date Picker</value> </param> <param> <name>customfield_10303</name> <type>userpicker</type> <value>$Jira_User Picker</value> </param> <param> <name>customfield_10304</name> <type>grouppicker</type> <value>$Jira_Group Picker</value> <param> <name>customfield_10306</name> <type>textarea</type> <value>$Jira_Free Text Field</value> </param> </request> <success>Successfully Integrated with Jira and the Jira id is : $id</success> <failure>Failed to Integrate to jira</failure> <!-- Specifies the fields that are to be updated after the action is executed --> <response> <param> <!-- name indicates the attribute in the return JSON object received from JIRA API --> <name>JIRA_ISSUE_ID</name> <!-- value indicates the SDP field that should be updated with the JIRA value --> <value>$ id</value> </param> <param> <!-- name indicates the attribute in the return JSON object received from JIRA API --> <name>JIRA_ISSUE_URL</name> <!-- value indicates the SDP field that should be updated with the JIRA value --> <value>$ self</value> </param> <!-- In any note needs to be added at the end of the operation, then it needs to be specified here. $message will take the value from the json object returned by JIRA. Hardcoded messages can also be given --> <notes> <note>Ticket is created in jira with key : $key And with Id: $id</note> <note>Ticket is created in jira with issueID : $id</note> </notes> </response> </menu> <menus>
|
![]() |