zoukankan      html  css  js  c++  java
  • CRM 2016 自动保存 Save event arguments

    Save event arguments (client-side reference)

     

    Applies To: Dynamics CRM 2016, Dynamics CRM Online

    In the save event you can use the execution context object getEventArgs method to retrieve an object that contains methods you can use to manage the save event.

    getSaveMode

    Returns a value indicating how the save event was initiated by the user.

    isDefaultPrevented

    Returns a value indicating whether the save event has been canceled because the preventDefault method was used in this event hander or a previous event handler.

    preventDefault

    Cancels the save operation, but all remaining handlers for the event will still be executed.

    Returns a value indicating how the save event was initiated by the user.

     
    execObj.getEventArgs().getSaveMode()
    
    Return Value

    Type: Number

    The following table describes the supported values returned to detect different ways entity records may be saved by the user.

    Entity

    Event Mode

    Value

    All

    Save

    1

    All

    Save and Close

    2

    All

    Save and New

    59

    All

    AutoSave

    70

    Activities

    Save as Completed

    58

    All

    Deactivate

    5

    All

    Reactivate

    6

    User or Team owned entities

    Assign

    47

    Email (E-mail)

    Send

    7

    Lead

    Qualify

    16

    Lead

    Disqualify

    15

    Remarks

    This method is essential if you want to enable auto-save for most forms in an organization but disable it for specific forms. The following code registered for the onSave event with the execution context passed to it will prevent any saves that initiate from an auto-save but allow all others. With auto-save enabled, navigating away is equivalent to Save and Close. This code will prevent any saves that are initiated by the 30 second timer or when people navigate away from a form with unsaved data.

     
    function preventAutoSave(econtext) {
        var eventArgs = econtext.getEventArgs();
        if (eventArgs.getSaveMode() == 70 || eventArgs.getSaveMode() == 2) {
            eventArgs.preventDefault();
        }
    }
    

    To save a record the user must click the Save Auto save button icon at the bottom of the form or a custom Save command needs to be added to the command bar.

    在需要设置的Form的窗体的OnSave事件添加上面的函数,同时勾上[将执行上下文作为第一个参数传递]这个选项即可.

    Returns a value indicating whether the save event has been canceled because the preventDefault method was used in this event hander or a previous event handler.

     
    execObj.getEventArgs().isDefaultPrevented()
    
    Return Value

    Type: Boolean

    Cancels the save operation, but all remaining handlers for the event will still be executed.

     
    execObj.getEventArgs().preventDefault()
    
  • 相关阅读:
    判断当天是周几
    九九乘法表
    js创建table表格
    tab切换-自动、点击、内容变换
    必须关注的25位知名JavaScript开发者
    静态路由
    dubbo
    SOA、SOAP、RPC
    【转】spring之任务调度
    Redis-cli命令最新总结【转】
  • 原文地址:https://www.cnblogs.com/BinBinGo/p/5880479.html
Copyright © 2011-2022 走看看