首页 > 代码库 > CRM SQL 创建活动 ActivityPointer
CRM SQL 创建活动 ActivityPointer
只是插入的任务,邮件,约会之类的没有研究,以下是官方文档:
https://msdn.microsoft.com/zh-cn/library/gg334533.aspx
/*1 实体名 new_xxxxxx2 实体ID new_xxxxxxid3 创建者ID4 责任人ID5 主题6 内容*/CREATE PROC p_create_active @entityname VARCHAR(100) , @entityid UNIQUEIDENTIFIER , @entityidname VARCHAR(400) , @createuserid UNIQUEIDENTIFIER , @ownerid UNIQUEIDENTIFIER , @zhuti NVARCHAR(MAX) , @neirong NVARCHAR(MAX) --set @entityname=‘new_xxxx‘--set @entityid =‘6697BB16-B020-E611-9697-00155D008213‘--set @entityidname =‘test_test‘--set @createuserid =‘16F347E1-9688-DE11-91C6-002219BF839D‘--set @ownerid =‘16F347E1-9688-DE11-91C6-002219BF839D‘--set @zhuti=‘卞功鑫测试主题4‘--set @neirong=‘卞功鑫测内容</br>第二行</br>第三行‘AS DECLARE @OTC INT , @OwningBus UNIQUEIDENTIFIER , @actid UNIQUEIDENTIFIER SET @actid = NEWID() SET @OwningBus = ( SELECT BusinessUnitId FROM SystemUser WHERE SystemUserid = @ownerid ) SET @OTC = ( SELECT TOP 1 ObjectTypeCode FROM Entity WHERE name = @entityname )----------------------创建活动指针---------------- DECLARE @Description0 NVARCHAR(MAX) , @OwningBusinessUnit0 UNIQUEIDENTIFIER , @RegardingObjectIdDsc0 INT , @RegardingObjectTypeCode0 INT , @StateCode0 INT , @StatusCode0 INT , @TimeZoneRuleVersionNumber0 INT , @Subject0 NVARCHAR(MAX) , @RegardingObjectId0 UNIQUEIDENTIFIER , @IsWorkflowCreated0 BIT , @CreatedOn0 DATETIME , @IsBilled0 BIT , @ActualDurationMinutes0 INT , @ActualStart0 DATETIME , @DeletionStateCode0 INT , @OwningUser0 UNIQUEIDENTIFIER , @ModifiedBy0 UNIQUEIDENTIFIER , @CreatedBy0 UNIQUEIDENTIFIER , @PriorityCode0 INT , @ModifiedOn0 DATETIME , @ActivityId0 UNIQUEIDENTIFIER , @RegardingObjectIdName0 NVARCHAR(MAX) , @ActivityTypeCode0 INT SET @Description0 = @neirong SET @OwningBusinessUnit0 = @OwningBus SET @RegardingObjectIdDsc0 = 0 SET @RegardingObjectTypeCode0 = @OTC SET @StateCode0 = 0 SET @StatusCode0 = 2 SET @TimeZoneRuleVersionNumber0 = 0 SET @Subject0 = @zhuti SET @RegardingObjectId0 = @entityid SET @IsWorkflowCreated0 = 0 SET @CreatedOn0 = GETDATE() SET @IsBilled0 = 0 SET @ActualDurationMinutes0 = 30 SET @ActualStart0 = GETDATE() SET @DeletionStateCode0 = 0 SET @OwningUser0 = @ownerid SET @ModifiedBy0 = @createuserid SET @CreatedBy0 = @createuserid SET @PriorityCode0 = 1 SET @ModifiedOn0 = GETDATE() SET @ActivityId0 = @actid SET @RegardingObjectIdName0 = @entityidname SET @ActivityTypeCode0 = 4212 INSERT INTO ActivityPointerBase ( Description , OwningBusinessUnit , RegardingObjectIdDsc , RegardingObjectTypeCode , StateCode , StatusCode , TimeZoneRuleVersionNumber , Subject , RegardingObjectId , IsWorkflowCreated , CreatedOn , IsBilled , ActualDurationMinutes , ActualStart , DeletionStateCode , OwningUser , ModifiedBy , CreatedBy , PriorityCode , ModifiedOn , ActivityId , RegardingObjectIdName , ActivityTypeCode ) VALUES ( @Description0 , @OwningBusinessUnit0 , @RegardingObjectIdDsc0 , @RegardingObjectTypeCode0 , @StateCode0 , @StatusCode0 , @TimeZoneRuleVersionNumber0 , @Subject0 , @RegardingObjectId0 , @IsWorkflowCreated0 , @CreatedOn0 , @IsBilled0 , @ActualDurationMinutes0 , @ActualStart0 , @DeletionStateCode0 , @OwningUser0 , @ModifiedBy0 , @CreatedBy0 , @PriorityCode0 , @ModifiedOn0 , @ActivityId0 , @RegardingObjectIdName0 , @ActivityTypeCode0 )-----创建任务 DECLARE @New_sendemail0 BIT , @New_sent0 BIT SET @New_sendemail0 = 1 SET @New_sent0 = 0 INSERT INTO TaskBase ( ActivityId ) VALUES ( @ActivityId0 ) INSERT INTO TaskExtensionBase ( New_sendemail , New_sent , ActivityId ) VALUES ( @New_sendemail0 , @New_sent0 , @ActivityId0 )-----------------共享权限-------------------------------------- DECLARE @referencingId UNIQUEIDENTIFIER , @referencingOTC INT , @referencedId UNIQUEIDENTIFIER , @referencedOTC INT SET @referencingId = @ActivityId0 --ActivityId SET @referencingOTC = ( SELECT ObjectTypeCode FROM Entity WHERE name = ‘ActivityPointer‘ ) --ActivityPointer SET @referencedId = @entityid--实体ID SET @referencedOTC = @OTC --New_scdpoa EXEC p_GrantInheritedAccess @referencingId, @referencingOTC, @referencedId, @referencedOTC--创建活动方 DECLARE @ActivityPartyId0 UNIQUEIDENTIFIER , @PartyId0 UNIQUEIDENTIFIER , @PartyObjectTypeCode0 INT , @ParticipationTypeMask0 INT , @AddressUsed0 NVARCHAR(MAX) SET @ActivityPartyId0 = NEWID() SET @PartyId0 = @ownerid SET @PartyObjectTypeCode0 = ( SELECT ObjectTypeCode FROM Entity WHERE name = ‘systemuser‘ ) SET @ParticipationTypeMask0 = 9 SET @AddressUsed0 = ( SELECT InternalEMailAddress FROM systemuser WHERE SystemUserId = @ownerid ) INSERT INTO ActivityPartyBase ( ActivityPartyId , ActivityId , PartyId , PartyObjectTypeCode , ParticipationTypeMask , AddressUsed ) VALUES ( @ActivityPartyId0 , @ActivityId0 , @PartyId0 , @PartyObjectTypeCode0 , @ParticipationTypeMask0 , @AddressUsed0 ) DECLARE @ActivityPartyId1 UNIQUEIDENTIFIER , @PartyId1 UNIQUEIDENTIFIER , @PartyObjectTypeCode1 INT , @ParticipationTypeMask1 INT SET @ActivityPartyId1 = NEWID() SET @PartyId1 = @entityid SET @PartyObjectTypeCode1 = @OTC SET @ParticipationTypeMask1 = 8 INSERT INTO ActivityPartyBase ( ActivityPartyId , PartyId , PartyObjectTypeCode , ActivityId , ParticipationTypeMask ) VALUES ( @ActivityPartyId1 , @PartyId1 , @PartyObjectTypeCode1 , @ActivityId0 , @ParticipationTypeMask1 )
CRM SQL 创建活动 ActivityPointer
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。