Hi,
I have created a trigger in sql server for maintain version. But now I want to implement this logic on plugin. Can you tell me how to implement this trigger on plugin in CRM 2013?
CREATE TRIGGER [dbo].[PWC_TR_UpdateProposalVersion]
ON [dbo].[new_proposalBase]
After Insert
AS
declare @opportunityId uniqueidentifier
declare @total decimal(23, 10)
declare @name nvarchar(100)
declare @proposalId uniqueidentifier
set @proposalId=(select new_proposalId from inserted)
set @opportunityId=(select new_Opportunity from inserted)
set @name=(select new_name from inserted)
set @total=(select count(new_proposalId)from new_proposalBase where new_Opportunity=@opportunityId and new_name=@name)-1
begin
UPDATE [new_proposalBase]
SET
new_version=1+(@total/10)
where new_proposalId=@proposalId
end
GO