适用于 Dynamics 365 渠道集成框架 1.0 的 raiseEvent(JavaScript API 参考)

调用事件的关联订阅者。

注释

如果已使用 addHandler 方法创建了自定义事件,则可以通过在此方法中将事件名称作为参数传递来引发这些事件。

Syntax

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

参数

Name 类型 必选 Description
事件名称 String 是的 需要调用其处理程序的事件的名称。
事件输入参数 JSON 字符串 是的 需要传递给处理程序函数的输入参数。
correlationId GUID 用于将所有相关 API 调用分组在一起以进行诊断遥测。

返回值

值为 Boolean 的 Promise。

Example

// 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 (点击行动)
onMode已更改
onPage导航
onSendKBArticle
onSize已更改