time 
设为首页】【收藏本站
当前位置: 主页 > ERP > CRM > Dynamic CRM管理常用SQL脚本

Dynamic CRM管理常用SQL脚本

时间:2015-01-08 15:55 点击:1095次 字体:[ ]




1. 查询角色、用户

SELECT DISTINCT
        u.FullName ,
        u.FirstName,
        u.InternalEMailAddress,
        r.Name,
        r.BusinessUnitIdName
FROM    SystemUser u
        JOIN systemuserroles ur ON u.SystemUserId = ur.SystemUserId
        JOIN Role r ON ur.RoleId = r.RoleId
        ORDER BY u.FullName

 

2. 审批流结点查询

        --审批模板
        SELECT  crm_default_flag ,
                crm_entity_name ,
                crm_approve_templeteId ,
                createdon ,
                crm_name ,
                crm_subject_field ,
                crm_wf_instanceid_field ,
                *
        FROM    crm_approve_templete
        WHERE   crm_approve_templeteId IN (
                '5B95D67C-A860-E411-9417-005056B01E9A',
                '5F95D67C-A860-E411-9417-005056B01E9A' )

--审批流程模板节点
        SELECT  crm_approver ,
                crm_wf_templete_nodeid ,
                crm_name ,
                a.crm_node_class ,
                b.Value ,
                crm_node_type ,
                crm_security_role '审批角色' ,
                crm_approver '审批人' ,
                CreatedOn ,
                crm_security_roleName ,
                crm_submit_busunitid ,
                *
        FROM    crm_wf_templete_node a ,
                StringMap b
        WHERE   a.crm_node_class = b.AttributeValue
                AND b.AttributeName = 'crm_node_class'
                AND crm_approve_templete_id IN (
                '5B95D67C-A860-E411-9417-005056B01E9A',
                '5F95D67C-A860-E411-9417-005056B01E9A' )

 

3. 报表

DECLARE @binUserGuid VARBINARY(128)

DECLARE @userGuid UNIQUEIDENTIFIER
SELECT @userGuid = ( SELECT TOP 1
                               SystemUserId
                     FROM      SystemUser
                     WHERE     DomainName = 'tct-hqcrmtadmin'
                   )
SET @binUserGuid = CAST(@userGuid AS VARBINARY(128))
SET context_info @binUserGuid



本文地址 : http://www.fengfly.com/plus/view-215522-1.html
标签: sql脚本 Dynamic CRM
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
验证码: