Compartilhar via


raiseEvent (Referência da API JavaScript) para Dynamics 365 Channel Integration Framework 1.0

Invoca o assinante associado para o evento.

Observação

Se você criou eventos personalizados usando o método addHandler, poderá gerar esses eventos passando o nome do evento como parâmetro nesse método.

Sintaxe

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

Parâmetros

Nome Tipo Obrigatório Description
nome_do_evento String Yes Nome do evento cujo manipulador precisa ser invocado.
eventInputParameters Cadeia de caracteres JSON Yes Os parâmetros de entrada que precisam ser passados para a função do manipulador.
correlationId GUID Não É usado para agrupar todas as chamadas de API relacionadas para telemetria de diagnóstico.

Valor de retorno

Promessa com um valor como booleano.

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
onModeChanged
onPageNavigate
onSendKBArticle
onSizeChanged