只是插入的任务,邮件,约会之类的没有研究,以下是官方文档:
https://msdn.microsoft.com/zh-cn/library/gg334533.aspx
/*
1 实体名 new_xxxxxx
2 实体ID new_xxxxxxid
3 创建者ID
4 责任人ID
5 主题
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
)
2016 版
--EXEC p_create_active
-- @entityname='new_xxxxxxx'
--, @entityid ='D7DE8E39-A051-E711-80C6-00505696ECED'
--, @entityidname ='测试账号2017/6/15的申请单'
--, @ownerid ='849F0105-9B04-E711-80C1-00505696ECED'
--, @zhuti='卞功鑫测试主题4'
--, @neirong='卞功鑫测内容
第二行
第三行'
--@entityname = new_xxxx
--@entityid = new_xxxxid
--@entityidname=new_xxxxidname
--@ownerid 接收任务的用户
--@zhuti 主题
--@neirong 内容
ALTER PROC p_create_active
@entityname VARCHAR(200),
@entityid VARCHAR(60),
@entityidname VARCHAR(200),
@ownerid VARCHAR(60),
@zhuti VARCHAR(1000),
@neirong VARCHAR(MAX)
WITH ENCRYPTION
AS
DECLARE
@ObjectTypeCode INT,
@OwningBusinessUnit UNIQUEIDENTIFIER,
@ActivityId UNIQUEIDENTIFIER,
@CreatedBy UNIQUEIDENTIFIER;
SET @ActivityId = NEWID();
SET @OwningBusinessUnit =
(
SELECT
BusinessUnitId
FROM
SystemUser
WHERE
SystemUserId = @ownerid
);
SET @ObjectTypeCode =
(
SELECT TOP 1
ObjectTypeCode
FROM
Entity
WHERE
Name = @entityname
);
SET @CreatedBy =
(
SELECT
SystemUserId
FROM
dbo.SystemUser
WHERE
FullName = 'xxxxxxxxx'
);
--活动
INSERT INTO dbo.ActivityPointerBase
(
OwningBusinessUnit,
ActualEnd,
ActivityId,
IsBilled,
CreatedBy,
Description,
ModifiedOn,
ServiceId,
ActivityTypeCode,
StateCode,
ScheduledEnd,
ScheduledDurationMinutes,
ActualDurationMinutes,
StatusCode,
ActualStart,
CreatedOn,
PriorityCode,
RegardingObjectId,
Subject,
IsWorkflowCreated,
ScheduledStart,
ModifiedBy,
RegardingObjectTypeCode,
RegardingObjectIdName,
TimeZoneRuleVersionNumber,
UTCConversionTimeZoneCode,
RegardingObjectIdYomiName,
RecApptMstrOverriddenCreatedOn,
RecApptMstrGlobalObjectId,
SeriesStatus,
RecApptMstrOutlookOwnerApptId,
DeletedExceptionsList,
NextExpansionInstanceDate,
RecApptMstrLocation,
GroupId,
LastExpandedInstanceDate,
ExpansionStateCode,
RecApptMstrCategory,
RecApptMstrIsAllDayEvent,
RecApptMstrSubcategory,
RecApptMstrSubscriptionId,
RecApptMstrImportSequenceNumber,
ModifiedFieldsMask,
CreatedOnBehalfBy,
OwnerId,
InstanceTypeCode,
SeriesId,
TransactionCurrencyId,
ExchangeRate,
IsRegularActivity,
OriginalStartDate,
ModifiedOnBehalfBy,
OwnerIdType,
QteCloseOverriddenCreatedOn,
QuoteNumber,
QteCloseImportSequenceNumber,
QteCloseCategory,
QteCloseRevision,
QteCloseSubcategory,
ApptCategory,
ApptGlobalObjectId,
ApptIsAllDayEvent,
ApptImportSequenceNumber,
ApptOutlookOwnerApptId,
ApptOverriddenCreatedOn,
ApptSubcategory,
ApptSubscriptionId,
ApptLocation,
ActualCost_Base,
CampActImportSequenceNumber,
BudgetedCost_Base,
ActualCost,
IgnoreInactiveListMembers,
DoNotSendOnOptOut,
TypeCode,
CampActSubcategory,
CampActOverriddenCreatedOn,
ExcludeIfContactedInXDays,
CampActCategory,
BudgetedCost,
CampActChannelTypeCode,
FirstName,
ReceivedOn,
ResponseCode,
YomiLastName,
CampResOverriddenCreatedOn,
YomiFirstName,
CompanyName,
CampResCategory,
Telephone,
OriginatingActivityId,
Fax,
LastName,
CampResImportSequenceNumber,
OriginatingActivityIdTypeCode,
EMailAddress,
CampResChannelTypeCode,
YomiCompanyName,
PromotionCodeName,
CampResSubcategory,
SuccessCount,
OperationTypeCode,
BulkOperationNumber,
TargetMembersCount,
CreatedRecordTypeCode,
Parameters,
ErrorNumber,
TargetedRecordTypeCode,
FailureCount,
Compressed,
ReadReceiptRequested,
DeliveryReceiptRequested,
EmailSubcategory,
Notifications,
MessageId,
Sender,
ToRecipients,
EmailOverriddenCreatedOn,
SubmittedBy,
EmailImportSequenceNumber,
EmailDirectionCode,
MimeType,
MessageIdDupCheck,
DeliveryAttempts,
TrackingToken,
EmailCategory,
SvcApptImportSequenceNumber,
SvcApptLocation,
SvcApptIsAllDayEvent,
SvcApptSubcategory,
SiteId,
SvcApptOverriddenCreatedOn,
SvcApptCategory,
SvcApptSubscriptionId,
TaskCategory,
PercentComplete,
TaskOverriddenCreatedOn,
TaskSubscriptionId,
TaskSubcategory,
TaskImportSequenceNumber,
Address,
LetterImportSequenceNumber,
LetterSubscriptionId,
LetterCategory,
LetterSubcategory,
LetterDirectionCode,
LetterOverriddenCreatedOn,
PhoneOverriddenCreatedOn,
PhoneImportSequenceNumber,
PhoneNumber,
PhoneSubcategory,
PhoneDirectionCode,
PhoneSubscriptionId,
PhoneCategory,
OrdCloseSubcategory,
OrdCloseImportSequenceNumber,
OrdCloseRevision,
OrderNumber,
OrdCloseCategory,
OrdCloseOverriddenCreatedOn,
FaxNumber,
CoverPageName,
NumberOfPages,
FaxSubscriptionId,
FaxImportSequenceNumber,
BillingCode,
Tsid,
FaxDirectionCode,
FaxOverriddenCreatedOn,
FaxSubcategory,
FaxCategory,
IncResSubcategory,
IncResCategory,
IncResImportSequenceNumber,
IncResOverriddenCreatedOn,
TimeSpent,
CompetitorId,
OppCloseOverriddenCreatedOn,
OppCloseImportSequenceNumber,
ActualRevenue_Base,
ActualRevenue,
OppCloseSubcategory,
OppCloseCategory,
EmailAttachmentCount,
ConversationIndex,
InReplyTo,
CorrelationMethod,
BaseConversationIndexHash,
ParentActivityId,
SenderMailboxId,
IsMapiPrivate,
LeftVoiceMail,
DeliveryLastAttemptedOn,
StageId,
DeliveryPriorityCode,
SentOn,
PostponeActivityProcessingUntil,
ProcessId,
OverriddenCreatedOn,
ImportSequenceNumber,
PostURL,
PostedOn,
PostAuthor,
ThreadId,
PostMessageType,
SentimentValue,
PostId,
PostFromProfileId,
PostToProfileId,
SocialActivityDirectionCode,
InResponseTo,
SocialAdditionalParams,
PostAuthorAccount,
PostAuthorType,
PostAuthorAccountName,
PostAuthorAccountType,
PostAuthorName,
PostAuthorYomiName,
PostAuthorAccountYomiName,
EmailSender,
SendersAccount,
EmailSenderName,
SendersAccountName,
EmailSenderObjectTypeCode,
SendersAccountObjectTypeCode,
SendersAccountYomiName,
EmailSenderYomiName,
CrmTaskAssignedUniqueId,
Community,
TraversedPath,
AttachmentErrors,
IsUnsafe,
CreatedByExternalParty,
ModifiedByExternalParty,
ActivityAdditionalParams,
OnHoldTime,
SLAInvokedId,
SLAId,
LastOnHoldTime
)
VALUES
(
@OwningBusinessUnit, -- OwningBusinessUnit - uniqueidentifier
NULL, -- ActualEnd - datetime --实际结束日期
@ActivityId, -- ActivityId - uniqueidentifier
0, -- IsBilled - bit
@CreatedBy, -- CreatedBy - uniqueidentifier
@neirong, -- Description - nvarchar(max) --内容
GETUTCDATE(), -- ModifiedOn - datetime
NULL, -- ServiceId - uniqueidentifier
4212, -- ActivityTypeCode - 4212:任务 4201:约会
0, -- StateCode - int 0 :已开启,1: 已完成,2: 已取消,3: 已计划
GETUTCDATE(), -- ScheduledEnd - datetime --预计结束
30, -- ScheduledDurationMinutes - int --预计持续分钟
30, -- ActualDurationMinutes - int--实际持续分钟
2, -- StatusCode - int 1: 已开启,2: 已完成,3: 已取消,4: 已计划
GETUTCDATE(), -- ActualStart - datetime
GETUTCDATE(), -- CreatedOn - datetime
1, -- PriorityCode - int 0 :低,1: 正常,2: 高
@entityid, -- RegardingObjectId - uniqueidentifier --关于字段,实体ID
@zhuti, -- Subject - nvarchar(200) --主题
0, -- IsWorkflowCreated - bit --是否工作流创建 1 :是,0:否
GETDATE(), -- ScheduledStart - datetime --预计开始分钟
@CreatedBy, -- ModifiedBy - uniqueidentifier
@ObjectTypeCode, -- RegardingObjectTypeCode - int --关于实体的 ObjectTypeCode
@entityidname, -- RegardingObjectIdName - nvarchar(4000) --关于实体的IDName
0, -- TimeZoneRuleVersionNumber - int
NULL, -- UTCConversionTimeZoneCode - int
NULL, -- RegardingObjectIdYomiName - nvarchar(4000)
NULL, -- RecApptMstrOverriddenCreatedOn - datetime
NULL, -- RecApptMstrGlobalObjectId - nvarchar(300)
1, -- SeriesStatus - bit
NULL, -- RecApptMstrOutlookOwnerApptId - int
NULL, -- DeletedExceptionsList - nvarchar(max)
NULL, -- NextExpansionInstanceDate - datetime
NULL, -- RecApptMstrLocation - nvarchar(200)
NULL, -- GroupId - uniqueidentifier
NULL, -- LastExpandedInstanceDate - datetime
0, -- ExpansionStateCode - int
NULL, -- RecApptMstrCategory - nvarchar(250)
0, -- RecApptMstrIsAllDayEvent - bit
NULL, -- RecApptMstrSubcategory - nvarchar(250)
NULL, -- RecApptMstrSubscriptionId - uniqueidentifier
NULL, -- RecApptMstrImportSequenceNumber - int
NULL, -- ModifiedFieldsMask - nvarchar(max)
NULL, -- CreatedOnBehalfBy - uniqueidentifier
@ownerid, -- OwnerId - uniqueidentifier
0, -- InstanceTypeCode - int
NULL, -- SeriesId - uniqueidentifier
'A158B8C7-2603-E711-80C0-00505696ECED', -- TransactionCurrencyId - uniqueidentifier
1.0000000000, -- ExchangeRate - decimal(23, 10)
1, -- IsRegularActivity - bit
NULL, -- OriginalStartDate - datetime
@ownerid, -- ModifiedOnBehalfBy - uniqueidentifier
8, -- OwnerIdType - int
NULL, -- QteCloseOverriddenCreatedOn - datetime
NULL, -- QuoteNumber - nvarchar(100)
NULL, -- QteCloseImportSequenceNumber - int
NULL, -- QteCloseCategory - nvarchar(250)
NULL, -- QteCloseRevision - int
NULL, -- QteCloseSubcategory - nvarchar(250)
NULL, -- ApptCategory - nvarchar(250)
NULL, -- ApptGlobalObjectId - nvarchar(300)
0, -- ApptIsAllDayEvent - bit
NULL, -- ApptImportSequenceNumber - int
NULL, -- ApptOutlookOwnerApptId - int
NULL, -- ApptOverriddenCreatedOn - datetime
NULL, -- ApptSubcategory - nvarchar(250)
NULL, -- ApptSubscriptionId - uniqueidentifier
NULL, -- ApptLocation - nvarchar(200)
NULL, -- ActualCost_Base - money
NULL, -- CampActImportSequenceNumber - int
NULL, -- BudgetedCost_Base - money
0, -- ActualCost - money
1, -- IgnoreInactiveListMembers - bit
1, -- DoNotSendOnOptOut - bit
NULL, -- TypeCode - int
NULL, -- CampActSubcategory - nvarchar(250)
NULL, -- CampActOverriddenCreatedOn - datetime
0, -- ExcludeIfContactedInXDays - int
NULL, -- CampActCategory - nvarchar(250)
0, -- BudgetedCost - money
NULL, -- CampActChannelTypeCode - int
NULL, -- FirstName - nvarchar(50)
NULL, -- ReceivedOn - datetime
NULL, -- ResponseCode - int
NULL, -- YomiLastName - nvarchar(150)
NULL, -- CampResOverriddenCreatedOn - datetime
NULL, -- YomiFirstName - nvarchar(150)
NULL, -- CompanyName - nvarchar(100)
NULL, -- CampResCategory - nvarchar(250)
NULL, -- Telephone - nvarchar(50)
NULL, -- OriginatingActivityId - uniqueidentifier
NULL, -- Fax - nvarchar(50)
NULL, -- LastName - nvarchar(50)
NULL, -- CampResImportSequenceNumber - int
NULL, -- OriginatingActivityIdTypeCode - int
NULL, -- EMailAddress - nvarchar(100)
NULL, -- CampResChannelTypeCode - int
NULL, -- YomiCompanyName - nvarchar(100)
NULL, -- PromotionCodeName - nvarchar(250)
NULL, -- CampResSubcategory - nvarchar(250)
0, -- SuccessCount - int
NULL, -- OperationTypeCode - int
NULL, -- BulkOperationNumber - nvarchar(32)
0, -- TargetMembersCount - int
NULL, -- CreatedRecordTypeCode - int
NULL, -- Parameters - nvarchar(max)
NULL, -- ErrorNumber - int
NULL, -- TargetedRecordTypeCode - int
0, -- FailureCount - int
0, -- Compressed - bit
0, -- ReadReceiptRequested - bit
0, -- DeliveryReceiptRequested - bit
NULL, -- EmailSubcategory - nvarchar(250)
NULL, -- Notifications - int
NULL, -- MessageId - nvarchar(320)
NULL, -- Sender - nvarchar(250)
NULL, -- ToRecipients - nvarchar(500)
NULL, -- EmailOverriddenCreatedOn - datetime
NULL, -- SubmittedBy - nvarchar(250)
NULL, -- EmailImportSequenceNumber - int
NULL, -- EmailDirectionCode - bit
NULL, -- MimeType - nvarchar(256)
'cc8f99fd-486e-4c39-aef7-7dd4d5fdbd0a', -- MessageIdDupCheck - uniqueidentifier
NULL, -- DeliveryAttempts - int
NULL, -- TrackingToken - nvarchar(50)
NULL, -- EmailCategory - nvarchar(250)
NULL, -- SvcApptImportSequenceNumber - int
NULL, -- SvcApptLocation - nvarchar(500)
0, -- SvcApptIsAllDayEvent - bit
NULL, -- SvcApptSubcategory - nvarchar(250)
NULL, -- SiteId - uniqueidentifier
NULL, -- SvcApptOverriddenCreatedOn - datetime
NULL, -- SvcApptCategory - nvarchar(250)
NULL, -- SvcApptSubscriptionId - uniqueidentifier
NULL, -- TaskCategory - nvarchar(250)
NULL, -- PercentComplete - int
NULL, -- TaskOverriddenCreatedOn - datetime
NULL, -- TaskSubscriptionId - uniqueidentifier
NULL, -- TaskSubcategory - nvarchar(250)
NULL, -- TaskImportSequenceNumber - int
NULL, -- Address - nvarchar(200)
NULL, -- LetterImportSequenceNumber - int
NULL, -- LetterSubscriptionId - uniqueidentifier
NULL, -- LetterCategory - nvarchar(250)
NULL, -- LetterSubcategory - nvarchar(250)
NULL, -- LetterDirectionCode - bit
NULL, -- LetterOverriddenCreatedOn - datetime
NULL, -- PhoneOverriddenCreatedOn - datetime
0, -- PhoneImportSequenceNumber - int
NULL, -- PhoneNumber - nvarchar(200)
NULL, -- PhoneSubcategory - nvarchar(250)
NULL, -- PhoneDirectionCode - bit
NULL, -- PhoneSubscriptionId - uniqueidentifier
NULL, -- PhoneCategory - nvarchar(250)
NULL, -- OrdCloseSubcategory - nvarchar(250)
NULL, -- OrdCloseImportSequenceNumber - int
NULL, -- OrdCloseRevision - int
NULL, -- OrderNumber - nvarchar(100)
NULL, -- OrdCloseCategory - nvarchar(250)
NULL, -- OrdCloseOverriddenCreatedOn - datetime
NULL, -- FaxNumber - nvarchar(200)
NULL, -- CoverPageName - nvarchar(100)
NULL, -- NumberOfPages - int
NULL, -- FaxSubscriptionId - uniqueidentifier
NULL, -- FaxImportSequenceNumber - int
NULL, -- BillingCode - nvarchar(50)
NULL, -- Tsid - nvarchar(20)
NULL, -- FaxDirectionCode - bit
NULL, -- FaxOverriddenCreatedOn - datetime
NULL, -- FaxSubcategory - nvarchar(250)
NULL, -- FaxCategory - nvarchar(250)
NULL, -- IncResSubcategory - nvarchar(250)
NULL, -- IncResCategory - nvarchar(250)
NULL, -- IncResImportSequenceNumber - int
NULL, -- IncResOverriddenCreatedOn - datetime
0, -- TimeSpent - int
NULL, -- CompetitorId - uniqueidentifier
NULL, -- OppCloseOverriddenCreatedOn - datetime
NULL, -- OppCloseImportSequenceNumber - int
NULL, -- ActualRevenue_Base - money
NULL, -- ActualRevenue - money
NULL, -- OppCloseSubcategory - nvarchar(250)
NULL, -- OppCloseCategory - nvarchar(250)
0, -- EmailAttachmentCount - int
NULL, -- ConversationIndex - nvarchar(2048)
NULL, -- InReplyTo - nvarchar(320)
NULL, -- CorrelationMethod - int
NULL, -- BaseConversationIndexHash - int
NULL, -- ParentActivityId - uniqueidentifier
NULL, -- SenderMailboxId - uniqueidentifier
0, -- IsMapiPrivate - bit
0, -- LeftVoiceMail - bit
NULL, -- DeliveryLastAttemptedOn - datetime
NULL, -- StageId - uniqueidentifier
1, -- DeliveryPriorityCode - int
NULL, -- SentOn - datetime
NULL, -- PostponeActivityProcessingUntil - datetime
NULL, -- ProcessId - uniqueidentifier
NULL, -- OverriddenCreatedOn - datetime
NULL, -- ImportSequenceNumber - int
NULL, -- PostURL - nvarchar(200)
NULL, -- PostedOn - datetime
NULL, -- PostAuthor - uniqueidentifier
NULL, -- ThreadId - nvarchar(160)
NULL, -- PostMessageType - int
NULL, -- SentimentValue - float
NULL, -- PostId - nvarchar(160)
NULL, -- PostFromProfileId - uniqueidentifier
NULL, -- PostToProfileId - nvarchar(200)
NULL, -- SocialActivityDirectionCode - bit
NULL, -- InResponseTo - nvarchar(160)
NULL, -- SocialAdditionalParams - nvarchar(max)
NULL, -- PostAuthorAccount - uniqueidentifier
NULL, -- PostAuthorType - int
NULL, -- PostAuthorAccountName - nvarchar(4000)
NULL, -- PostAuthorAccountType - int
NULL, -- PostAuthorName - nvarchar(4000)
NULL, -- PostAuthorYomiName - nvarchar(4000)
NULL, -- PostAuthorAccountYomiName - nvarchar(4000)
NULL, -- EmailSender - uniqueidentifier
NULL, -- SendersAccount - uniqueidentifier
NULL, -- EmailSenderName - nvarchar(4000)
NULL, -- SendersAccountName - nvarchar(4000)
NULL, -- EmailSenderObjectTypeCode - int
NULL, -- SendersAccountObjectTypeCode - int
NULL, -- SendersAccountYomiName - nvarchar(4000)
NULL, -- EmailSenderYomiName - nvarchar(4000)
NULL, -- CrmTaskAssignedUniqueId - uniqueidentifier
NULL, -- Community - int
NULL, -- TraversedPath - nvarchar(1250)
NULL, -- AttachmentErrors - int
0, -- IsUnsafe - int
NULL, -- CreatedByExternalParty - uniqueidentifier
NULL, -- ModifiedByExternalParty - uniqueidentifier
NULL, -- ActivityAdditionalParams - nvarchar(max)
NULL, -- OnHoldTime - int
NULL, -- SLAInvokedId - uniqueidentifier
NULL, -- SLAId - uniqueidentifier
NULL -- LastOnHoldTime - datetime
);
--活动对象
--责任人
INSERT INTO dbo.ActivityPartyBase
(
ActivityId,
ActivityPartyId,
PartyId,
PartyObjectTypeCode,
ParticipationTypeMask,
AddressUsed,
PartyIdName,
Effort,
ExchangeEntryId,
ResourceSpecId,
DoNotPhone,
ScheduledEnd,
ScheduledStart,
IsPartyDeleted,
AddressUsedEmailColumnNumber
)
VALUES
(
@ActivityId, -- ActivityId
NEWID(), -- ActivityPartyId
@ownerid, -- PartyId -用户或者实体的ID
8, -- PartyObjectTypeCode - 用户和实体的
9, -- ParticipationTypeMask -8:关于, 9:负责人
NULL, -- AddressUsed - nvarchar(200)
NULL, -- PartyIdName - nvarchar(4000)
NULL, -- Effort - float
NULL, -- ExchangeEntryId - nvarchar(1024)
NULL, -- ResourceSpecId - uniqueidentifier
NULL, -- DoNotPhone - bit
GETDATE(), -- ScheduledEnd - 截至日期
GETDATE(), -- ScheduledStart - 开始日期=截至日期-持续时间
0, -- IsPartyDeleted - bit
NULL -- AddressUsedEmailColumnNumber - int
);
--关于
INSERT INTO dbo.ActivityPartyBase
(
ActivityId,
ActivityPartyId,
PartyId,
PartyObjectTypeCode,
ParticipationTypeMask,
AddressUsed,
PartyIdName,
Effort,
ExchangeEntryId,
ResourceSpecId,
DoNotPhone,
ScheduledEnd,
ScheduledStart,
IsPartyDeleted,
AddressUsedEmailColumnNumber
)
VALUES
(
@ActivityId, -- ActivityId
NEWID(), -- ActivityPartyId
@entityid, -- PartyId -用户或者实体的ID
@ObjectTypeCode, -- PartyObjectTypeCode - 用户和实体的
8, -- ParticipationTypeMask -8:关于, 9:负责人
NULL, -- AddressUsed - nvarchar(200)
NULL, -- PartyIdName - nvarchar(4000)
NULL, -- Effort - float
NULL, -- ExchangeEntryId - nvarchar(1024)
NULL, -- ResourceSpecId - uniqueidentifier
NULL, -- DoNotPhone - bit
GETDATE(), -- ScheduledEnd - 截至日期
GETDATE(), -- ScheduledStart - 开始日期=截至日期-持续时间
0, -- IsPartyDeleted - bit
NULL -- AddressUsedEmailColumnNumber - int
);
--任务登记Task
INSERT INTO TaskBase
(
ActivityId
)
VALUES
(
@ActivityId
);