locked
Cancel Update Notes in Crm 2013 RRS feed

  • Question

  • Hi everybody,

    The task is to prevent from updating note records on the form of Account for user with specific roles.

    The user can create Notes but should not be able to update it.

    Any solutions?


    Till now i've done it with Pre-Update plugin. The Code:

     bool success;
                    Entity target = PluginOperations.GetContextTarget(m_pluginExecutionContext, out success);
                    if (success)
                    {
                        string[] rolesFromSystemParams = RetrieveRolesFromSystemParameters();
                        if (rolesFromSystemParams != null && rolesFromSystemParams.Length > 0)
                        {
                            bool canUpdate = RetrieveLogedInUserRoles(rolesFromSystemParams);
                            if (!canUpdate)
                            {
                                throw new InvalidPluginExecutionException("The user has no priveleges to update note records.")
                                {
                                    Source = "Plugin : NoteBL. Method : PreUpdateAnnotation. The user has no priveleges to update note records"
                                };
                            }
                        }
                        else
                        {
                            throw new InvalidPluginExecutionException("The user has no priveleges to update note records.")
                            {
                                Source = "Plugin : NoteBL. Method : PreUpdateAnnotation. The user has no priveleges to update note records"
                            };
                        }
                    }


    The problem is that i get two Error messages.

    The first is:

    When i click ok =>


    How can I remove the first error window?

    Can I change the Business Process Error to my custom message?

    Thanks

    Yuri


    Monday, August 11, 2014 1:48 PM