Monday, October 22, 2012

how to hide marketing module for some user roles in ms crm 2011?

We have sale, marketing and service modules in the CRM. We want to show the sale module only to the sales user,  marketing module only to marketing users, service module to service users.

Create a custom Entity named “HideModule”.

Export the site map[Keep a backup].

Edit the sitemap.
In sales for all the SubArea add the Privilege only to “create” on the custom entity “HideModule”.  
<Privilege Entity="new_HideModule" Privilege="Create" />
In Marketing for all the SubArea add the Privilege only to “Read” for the custom entity “HideModule”.  
<Privilege Entity="new_HideModule" Privilege="Read" />
In Settings for all the SubArea add the Privilege only to “Write” for the custom entity “HideModule”.  
<Privilege Entity="new_HideModule" Privilege="Write" />

Save and import the soluntion.

In security roles give the Create Privilege on “HideModule” to all sales roles, Read Privilege on “HideModule” to all marketing roles, Write Privilege on “HideModule” to all service roles.  

Wednesday, October 3, 2012

query to kill all the process [used when restoring the database]


use  master
DECLARE @dbname sysname
SET @dbname = 'DataBase Name'

DECLARE @spid int
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname)
WHILE @spid IS NOT NULL
BEGIN
EXECUTE ('KILL ' + @spid)
SELECT @spid = min(spid) from master.dbo.sysprocesses where dbid = db_id(@dbname) AND spid > @spid
END