The Microsoft Business Applications Practice at HCLTech is thrilled to be at HIMSS23 in April. That’s right, we’re back in person and excited to be one of the select partners to share a booth with Microsoft.
After applying Update Rollup 8 to the CRM server we were unable to assign records. The error we were receiving in the CRM platform trace was the following:
>Crm Exception: Message: , ErrorCode: -2147204784, InnerException: System.Data.SqlClient.SqlException: Could not find stored procedure 'dbo.p_CascadeCollectAssign'.
When we looked at the Stored Procedures for the organization, the dbo.p_CascadeCollectAssign was missing. Reinstalling Update Rollup 8 did not recreate the stored procedure. We also tried installing later rollups which also did not recreate the stored procedure.
We ended up manually creating the Stored Procedure with the following script:
Note: You will need to change organization to the actual name of your organization. Please make sure to make a complete backup of the database before making any changes.
USE [organization_MSCRM]
GO
/****** Object: StoredProcedure [dbo].[p_CascadeCollectAssign] Script Date: 05/21/2010 10:25:09 ******/
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
create
proc [dbo].[p_CascadeCollectAssign]
(
@operation_type nvarchar(40),
@root_entity_otc int,
@root_entity_oid uniqueidentifier,
@isOffline int,
@old_owner uniqueidentifier
)
as
begin
set
nocount
on
begin
insert
into #CascadeCollectAssign select o, t, p, q, s, y
from dbo.fn_CollectForCascadeAssign
(@root_entity_oid
,@root_entity_otc
,@isOffline
,@old_owner
)
update #CascadeCollectAssign set processed = 2
end
end
GO
Welcome to the #1 Dynamics CRM Partner in the World
Proud winner of the 2015 Microsoft Partner of the Year for Cloud Customer Relationship Management, PowerObjects is the preferred partner for implementing, supporting, and growing CRM solutions. Through unparalleled offerings of service, support, education, and add-ons, PowerObjects can help tailor custom solutions for your business.
How Can We Help You Today?
Is this a bug with R8 or was this something quirky in your environment?
Cheers
Hi Anne,
Yeah - it is a bug with UR 8. It does not happen all the time, but we have seen a number of orgs coming from servers with UR 8 that had this issue.
Strange, does not work for me ...
* had cumulative UR 9
- added Organization
- Tried to assign company -> Fail
* installed ur 10
- Tried to assign company -> Fail
* Tried to run script above
- SQL complains about missing columns q, s, y
- looked into dbo.fn_CollectForCascadeAssign
returns @t table
(
o uniqueidentifier,
t int,
p int default 0,
u uniqueidentifier
)
==> Seems like fn_CollectForCascadeAssign is messed up as well with my installation (or was changed by ur 10?) 🙁
Hi,
Yep - I just checked with our support desk and we have seen this before too. The fix is to re-create the stored procedure. TOtaly unsupported, but worked for us:
USE [XXXXXXXXXXXXXXX_MSCRM]
GO
/****** Object: UserDefinedFunction [dbo].[fn_CollectForCascadeAssign] Script Date: 05/26/2010 14:47:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE function [dbo].[fn_CollectForCascadeAssign]
(
@root_id uniqueidentifier,
@root_otc int,
@isoffline int,
@old_owner uniqueidentifier
)
returns @t table
(
o uniqueidentifier,
t int,
p int default 0,
u uniqueidentifier,
q uniqueidentifier,
s int,
y bit default 0
)
as
begin
insert into @t values(@root_id,@root_otc,0,@old_owner,N'00000000-0000-0000-0000-000000000000',0,0)
if(exists(select * from @t where t=9100))begin insert into @t(o,t,p,u,q,s,y) select o.ReportId,9100,0,o.OwningUser,c.o,c.t,1 from Report o,@t c where o.ParentReportId=c.o and c.t=9100 and o.DeletionStateCode=0
while(@@rowcount <> 0)if(exists(select * from @t where t=9100))insert into @t(o,t,p,u,q,s,y) select o.ReportId,9100,0,o.OwningUser,c.o,c.t,1 from Report o,@t c where o.ParentReportId=c.o and c.t=9100 and o.DeletionStateCode=0 and o.ReportId not in(select o from @t where o=o.ReportId and t=9100) end
if(exists(select * from @t where t in(4400,4406)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4401,0,o.OwningUser,c.o,c.t,1 from CampaignResponse o,@t c where o.RegardingObjectId=c.o and c.t in(4400,4406) and o.DeletionStateCode=0 end
if(exists(select * from @t where t=10008))begin insert into @t(o,t,p,u,q,s,y) select o.Po_dashboardchartId,10009,0,o.OwningUser,c.o,c.t,1 from Po_dashboardchart o,@t c where o.po_dashboardid=c.o and c.t=10008 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=4400))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4402,0,o.OwningUser,c.o,c.t,1 from CampaignActivity o,@t c where o.RegardingObjectId=c.o and c.t=4400 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.AccountId,1,0,o.OwningUser,c.o,c.t,1 from Account o,@t c where o.ParentAccountId=c.o and c.t=1 and o.DeletionStateCode=0
while(@@rowcount <> 0)if(exists(select * from @t where t=1))insert into @t(o,t,p,u,q,s,y) select o.AccountId,1,0,o.OwningUser,c.o,c.t,1 from Account o,@t c where o.ParentAccountId=c.o and c.t=1 and o.DeletionStateCode=0 and o.AccountId not in(select o from @t where o=o.AccountId and t=1) end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.ContactId,2,0,o.OwningUser,c.o,c.t,1 from Contact o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.ContactId,2,0,o.OwningUser,c.o,c.t,1 from Contact o,@t c where o.ParentContactId=c.o and c.t=2 and o.DeletionStateCode=0
while(@@rowcount <> 0)if(exists(select * from @t where t=2))insert into @t(o,t,p,u,q,s,y) select o.ContactId,2,0,o.OwningUser,c.o,c.t,1 from Contact o,@t c where o.ParentContactId=c.o and c.t=2 and o.DeletionStateCode=0 and o.ContactId not in(select o from @t where o=o.ContactId and t=2) end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.InvoiceId,1090,0,o.OwningUser,c.o,c.t,1 from Invoice o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.InvoiceId,1090,0,o.OwningUser,c.o,c.t,1 from Invoice o,@t c where o.ContactId=c.o and c.t=2 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.SalesOrderId,1088,0,o.OwningUser,c.o,c.t,1 from SalesOrder o,@t c where o.ContactId=c.o and c.t=2 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.SalesOrderId,1088,0,o.OwningUser,c.o,c.t,1 from SalesOrder o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1088))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4209,0,o.OwningUser,c.o,c.t,1 from OrderClose o,@t c where o.SalesOrderId=c.o and c.t=1088 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.QuoteId,1084,0,o.OwningUser,c.o,c.t,1 from Quote o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.QuoteId,1084,0,o.OwningUser,c.o,c.t,1 from Quote o,@t c where o.ContactId=c.o and c.t=2 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1084))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4211,0,o.OwningUser,c.o,c.t,1 from QuoteClose o,@t c where o.QuoteId=c.o and c.t=1084 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.ContractId,1010,0,o.OwningUser,c.o,c.t,1 from Contract o,@t c where o.ContactId=c.o and c.t=2 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.ContractId,1010,0,o.OwningUser,c.o,c.t,1 from Contract o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.IncidentId,112,0,o.OwningUser,c.o,c.t,1 from Incident o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.IncidentId,112,0,o.OwningUser,c.o,c.t,1 from Incident o,@t c where o.ContactId=c.o and c.t=2 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=112))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4206,0,o.OwningUser,c.o,c.t,1 from IncidentResolution o,@t c where o.IncidentId=c.o and c.t=112 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.LeadId,4,0,o.OwningUser,c.o,c.t,1 from Lead o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.LeadId,4,0,o.OwningUser,c.o,c.t,1 from Lead o,@t c where o.ContactId=c.o and c.t=2 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=2))begin insert into @t(o,t,p,u,q,s,y) select o.OpportunityId,3,0,o.OwningUser,c.o,c.t,1 from Opportunity o,@t c where o.ContactId=c.o and c.t=2 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=1))begin insert into @t(o,t,p,u,q,s,y) select o.OpportunityId,3,0,o.OwningUser,c.o,c.t,1 from Opportunity o,@t c where o.AccountId=c.o and c.t=1 and o.DeletionStateCode=0 end
if(exists(select * from @t where t=3))begin insert into @t(o,t,p,u,q,s,y) select o.CustomerOpportunityRoleId,4503,0,o.OwningUser,c.o,c.t,1 from CustomerOpportunityRole o,@t c where o.OpportunityId=c.o and c.t=3 and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(1088,10002,3,112,2,10004,10003,4,10005,10007,10006,10001,1090,1084,10000,1010,1)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4214,0,o.OwningUser,c.o,c.t,1 from ServiceAppointment o,@t c where o.RegardingObjectId=c.o and c.t in(1088,10002,3,112,2,10004,10003,4,10005,10007,10006,10001,1090,1084,10000,1010,1) and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(10007,10004,10000,10006,112,1090,1088,1,1084,2,4,4400,3,1010,10001,10003,10005,10002)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4212,0,o.OwningUser,c.o,c.t,1 from Task o,@t c where o.RegardingObjectId=c.o and c.t in(10007,10004,10000,10006,112,1090,1088,1,1084,2,4,4400,3,1010,10001,10003,10005,10002) and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(10004,4402,4406,112,10005,1010,2,10002,10003,1088,3,10006,1084,10000,10007,10001,4,1,1090)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4210,0,o.OwningUser,c.o,c.t,1 from PhoneCall o,@t c where o.RegardingObjectId=c.o and c.t in(10004,4402,4406,112,10005,1010,2,10002,10003,1088,3,10006,1084,10000,10007,10001,4,1,1090) and o.DeletionStateCode=0 end
if(exists(select * from @t where t=3))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4208,0,o.OwningUser,c.o,c.t,1 from OpportunityClose o,@t c where o.OpportunityId=c.o and c.t=3 and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(4406,4402,1010,1088,10007,10004,10000,10003,10005,10002,2,1084,1090,3,4,112,10001,10006,1)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4207,0,o.OwningUser,c.o,c.t,1 from Letter o,@t c where o.RegardingObjectId=c.o and c.t in(4406,4402,1010,1088,10007,10004,10000,10003,10005,10002,2,1084,1090,3,4,112,10001,10006,1) and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(1084,2,10004,1090,1010,4406,10006,3,10000,4,1088,10002,10003,4402,10005,1,10001,10007,112)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4204,0,o.OwningUser,c.o,c.t,1 from Fax o,@t c where o.RegardingObjectId=c.o and c.t in(1084,2,10004,1090,1010,4406,10006,3,10000,4,1088,10002,10003,4402,10005,1,10001,10007,112) and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(4402,4406,1088,10005,3,1,10006,10007,112,1084,10004,1090,1010,10001,4,10000,10002,10003,2,4700)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4202,0,o.OwningUser,c.o,c.t,1 from Email o,@t c where o.RegardingObjectId=c.o and c.t in(4402,4406,1088,10005,3,1,10006,10007,112,1084,10004,1090,1010,10001,4,10000,10002,10003,2,4700) and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(1084,10006,4,4406,1090,1010,4402,10007,1,112,10005,10000,10001,1088,10004,10003,2,3,10002)))begin insert into @t(o,t,p,u,q,s,y) select o.ActivityId,4201,0,o.OwningUser,c.o,c.t,1 from Appointment o,@t c where o.RegardingObjectId=c.o and c.t in(1084,10006,4,4406,1090,1010,4402,10007,1,112,10005,10000,10001,1088,10004,10003,2,3,10002) and o.DeletionStateCode=0 end
if(exists(select * from @t where t in(2,4402,1088,1084,10001,1,4204,1090,10008,4400,10009,4208,4202,4209,4210,4201,4214,4212,4414,4300,4206,4211,4401,112,4207,10002,3,10007,10000,4703,4,10005,10003,10006,10004,1010)))begin insert into @t(o,t,p,u,q,s,y) select o.AnnotationId,5,0,o.OwningUser,c.o,c.t,1 from Annotation o,@t c where o.ObjectId=c.o and c.t in(2,4402,1088,1084,10001,1,4204,1090,10008,4400,10009,4208,4202,4209,4210,4201,4214,4212,4414,4300,4206,4211,4401,112,4207,10002,3,10007,10000,4703,4,10005,10003,10006,10004,1010) and o.DeletionStateCode=0 end
return
end
GO
make sure rollup7 is installed then install later rollups - regardless of the fact that MS say it is not necessary
You even need to do this on a clean install
basic install
rollup 7 - I did all components - not just the clientas MS suggests
rollup 11 (or whatever 8-11)
this has worked in 3 installs