次の方法で共有


Dynamics 365 チャネル統合フレームワーク 1.0 の raiseEvent (JavaScript API リファレンス)

イベントに関連付けられたサブスクライバーを呼び出します。

注意

addHandler メソッド を使用してカスタム イベントを作成した場合は、このメソッドのパラメータとしてイベント名を渡すことで、それらのイベントを発生させることができます。

構文

Microsoft.CIFramework.raiseEvent(eventName, eventInputParameters, correlationId);

Parameters

件名 タイプ Required Description
eventName String 有効 ハンドラーを呼び出す必要があるイベントの名前です。
eventInputParameters JSON String 有効 ハンドラー関数に渡す必要のある入力パラメーターです。
correlationId GUID 番号 診断テレメトリのために、関連するすべての API 呼び出しをグループ化するために使用されます。

値を返す

ブール値を持つプロミスです。

// Let there be an event registered to a subscriber.
handlerFunction = function(eventInput) 
{
    console.log(eventInput);
    if(eventInput != null &&  eventInput != undefined && eventInput.size > 0) 
    {
        inputData = eventInput.get("value");
        correlationId = eventInput.get("correlationId");
        console.log(inputData + " " + correlationId);
    }
    return Promise.resolve();
}
Microsoft.CIFramework.addHandler("oncustomevent", handlerFunction);
//Use raiseEvent API to invoke the subscribed handler of the event.
Microsoft.CIFramework.raiseEvent("oncustomevent", "test input value");

//In the main UCI page
Microsoft.CIFramework.addHandler("widgetEvent", handlerFunction);
///In the widget code
Microsoft.CIFramework.raiseEvent("widgetEvent", eventInput);

//In the widget code
Microsoft.CIFramework.addHandler("mainPageEvent", handlerFunction);
//In the main UCI page
Microsoft.CIFramework.raiseEvent("mainPageEvent", eventInput);

参照

onClickToAct
onModeChanged
onPageNavigate
onSendKBArticle
onSizeChanged