zoukankan      html  css  js  c++  java
  • Stopping Deactivation of Records in Dynamics 365

     

    There was a question recently on CRMUG about how to modify security to prevent users from Deactivating Contacts.

    In Dynamics 365, the security roles can be configured (and is best practice) to prevent users from deleting records.

    Removing Delete Option Generally a good idea.

    Deactivating records is generally a safer process as it can be reversed and no information is lost.  However, there may be processes and reports that will only pull data from active records so it may be a business requirement to prevent users from deactivating records.

    Since “deactivating” a contact is really just modifying a field value (status “active” to “inactive”) the privilege is controlled by the “edit” permission.  Obviously users need to add and edit records!

    One solution is to use the Ribbon Workbench and edit the menu to hide/show the deactivate button based on security roles.  This is a viable solution but requires some level of JavaScript and knowledge of the Ribbon workbench, not hard but not exactly a picnic either.

    Workflow Solution

    Another solution would be to utilize workflow to prevent a user from deactivating a record.

    The first thing would be to add a boolean field to the system user record to effectively set the security privelege of being able to deactivate a record (or not).  In my example, I will add a restriction on deactivating contacts.

    For the User record, I will add a new “permission” boolean field.  I also enabled field security to prevent modification but unauthorized users.

    Once the field is added to entity, it will need to be placed on the form.

    The next step will be to create a synchronous workflow that is triggered anytime the record status changes.  The workflow will check to see if the record’s status is “inactive” and if the “Last Modified User” actually has the permission to deactivate the record.

    The workflow needs to be synchronous because we want the user to know immediately that they are not allowed to deactivate the contact.

    The first condition to check would be to see if the status has been set to “inactive” and also to check if the last modified by user has the permission to deactivate records.

    If the conditions are met, the next step is to set the contact “back” to being active.

    Once the contact is set back to active, it is courtesy to let the user know (so they don’t think that they are going crazy).

    How come the Deactivate didn’t work?

    Use the “Cancel Workflow” step.

    The reason why we want the “cancel workflow” is so that an error message will be surfaced to the end user.

    In the “Set Properties” you can put in your own custom error message.

    Save and activate the workflow.

    You will then need to set the appropriate “permission” on the user record.

    You will also need to setup a Field Security profile so that users will be able to “read” the value from the user records.  You can add the default Business Unit team to this profile to easily provide this access.

    Now, a user will still be able to attempt to “deactivate” a record…

    However, once the user continues, a Business Process message will appear (showing the custom error message)

    While this might not be the most elegant solution, it will serve the purpose.

    What it also highlights is yet another example of the possibilities of the configuration options using Dynamics 365.

  • 相关阅读:
    PHPCMS V9 导航栏当前栏目高亮
    phpcms v9栏目列表调用每一篇文章内容方法
    PHPCMS V9 为今天或几天前文章加new
    vue.js路由参数简单实例讲解------简单易懂
    vue组件知识总结
    vue.js 利用组件之间通讯,写一个弹出框例子
    vue.js组件之间通讯--父组件调用子组件的一些方法,子组件暴露一些方法,让父组件调用
    vue.js组件之间的通讯-----父亲向儿子传递数据,儿子接收父亲的数据
    vue.js通讯----父亲拿儿子的数据
    git常见操作---由简入深
  • 原文地址:https://www.cnblogs.com/lingdanglfw/p/15375597.html
Copyright © 2011-2022 走看看