raiseEvent (JavaScript API Reference) para Dynamics 365 Channel Integration Framework 1.0

Invoca o subscritor asociado para o evento.

Nota

Se creou eventos personalizados usando o método addHandler, entón pode levantar eses eventos pasando o nome do evento como parámetro neste método.

Sintaxe

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

Parámetros

Nome Type Requírese Descripción
Nome do eventoName Cadea Si Nome do evento cuxo manipulador debe ser invocado.
eventInputParameters Cadea JSON Si Os parámetros de entrada que deben pasar á función do manexador.
Identificador de correlación GUID No Utilízase para agrupar todas as chamadas de API relacionadas para a telemetría diagnóstica.

Valor de devolución

Promesa cun valor como booleano.

Exemplo

// 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
OnPageBrowse
onSendKBArticle
onSizeChanged