Client API Object Model - Execution Context

1. executionContext.

  executionContext定义代码在其中执行的上下文. 并且适用在再form或者grid中的event handler. 比如formContext 或者 gridContext, 或者是save event中.

有两种方式去定义,适用execution context:

  1. 适用UI来定义event handlers. 适用Pass execution context as first parameter 在handler properties中.

  2. 使用代码来定义event handler.

    Execution context 是使用代码自动传递到第一个参数到function中.

https://docs.microsoft.com/en-us/powerapps/developer/model-driven-apps/clientapi/events-forms-grids#add-or-remove-event-handler-function-to-event-using-code

  用代码做执行功能

  例如:

function DisplayHelloWorld(executionContext) {
    var formContext = executionContext.getFormContext();

    var firstName = formContext.getAttribute("firstname").getValue();

    alert("Hello World " + firstName);
}

猜你喜欢

转载自www.cnblogs.com/TheMiao/p/12064715.html