RE: CRM 3.0: Cannot delete account, opportunity by Stonesifer
Stonesifer
Tue Aug 05 10:26:02 CDT 2008
You are going to need to run a script on the backend. I just completed this
on CRM 4.0. While Microsoft does not think this is a best practice it still
works. I set the statecodes to open and then deleted on the GUI interface as
discussed and the data did not show on the app, however when I ran the
reports it still showed because it didnt delete out of the DB, I recommend
deleting on GUI first then deleting on DB also.
You will need to change some of the delete commands to select and then
delete based on the ID's found, but this is a general idea.
/**********This Query will Delete All TEST sales activity*************/
/****Reset all*******/
Update OpportunityBase set statecode = 0 where name like '%test%'
Update quotebase set statecode = 0 where name like '%test%'
Update SalesOrderbase set statecode = 0 where name like '%test%'
Update invoicebase set statecode = 0 where name like '%test%'
/*****Invoices*****/
delete from invoicedetailbase where invoiceid =
delete from invoicebase where name like 'Test%'
/*****Orders*****/
Delete from Salesorderdetailbase DB
Inner Join SalesOrderBase OB On OB.SalesOrderID = DB.SalesOrderID
Where OB.Name like 'test%'
delete from salesorderbase where name like 'test%'
/*******Quotes******/
Delete from QuoteDetailBase DB
Inner Join QuoteBase QB On QB.Quoteid = DB. QuoteID
WHere QB.Name like 'Test%'
delete from quotebase where name like 'Test%'
Select * from quotebase where name like 'Test%'
/******Opportunity******/
Delete From New_OpportunityItemsExtensionBase N
Inner Join OpportunityBase OB On OB.OpportunityID = N.New_OpportunityID
Where OB.Name like 'Test%'
delete from opportunitybase where name like 'test%'
"Phumulani" wrote:
> Hi Donna,
>
> Thanks it worked like a charm.
> --
> phumulaniluyandacollinlembede
>
>
> "Donna" wrote:
>
> > Hi,
> >
> > Orders are usually created from Quotes which are also related to
> > Opportunities. If your Orders are associated to Quotes and Opportunities,
> > then you have to adjust those records as well.
> >
> > Best Regards,
> > Donna
> >
> > "Phumulani" wrote:
> >
> > > hi
> > >
> > > in CRM 4.0 i want to delete closed orders, i changed the statecode using sql
> > > and yes the record was then editable. but when i delete it through the GUI i
> > > get an errror "This record cannot be deleted because it is associated with
> > > other entity" please advise.
> > > --
> > > phumulaniluyandacollinlembede
> > >
> > >
> > > "Donna" wrote:
> > >
> > > > One comment, if you are going to remove the records from the database using
> > > > an unsupported method, I recommend that you change the statecode back to
> > > > 'draft' status on the records and then delete the records through the GUI
> > > > rather than setting the delete flag in the database. This will ensure that
> > > > all associated records are deleted. Otherwise you could end up with orphaned
> > > > records in the database that you didn't anticipate.
> > > >
> > > > However, it is NEVER recommended to use unsupported methods to make updates
> > > > to the database.
> > > >
> > > > Donna
> > > >
> > > > "Gregor" wrote:
> > > >
> > > > > as far as i know you are not allowed to delete closed opportunities, quotes,
> > > > > ...
> > > > >
> > > > > two things you can do (as far as I know):
> > > > > 1. and supported way: export your customizings and adressdata setup a new
> > > > > crm import customizing and start from scratch.
> > > > > 2. and surly unsupported way: set the delete flag in the database for the
> > > > > datasets and wait for the deletion service to clean them.
> > > > >
> > > > > NO WAY: don't delete them manualy from the database
> > > > >
> > > > > hope it helps
> > > > >
> > > > >
> > > > > "Quang Hoang" wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > I have been working with MS CRM 3.0 in the last few months and have created
> > > > > > number of test accounts and test opportunities , now I'd like to remove all
> > > > > > those test opportuniites/accounts from my system but not succesful. Don't
> > > > > > know why.
> > > > > >
> > > > > > When I tried to delete them, some of my opportunities (and Accounts) could
> > > > > > not be deleted, it said "The record cannot be deleted because it is
> > > > > > read-only". I'd trying to delete all its quotes, orders, relationships but
> > > > > > still could not do so.
> > > > > >
> > > > > > My role is System Administrator and I assumed this role gives me full
> > > > > > control of the system but it did not work this time.
> > > > > >
> > > > > > Can you please assist us to look into this issue and advise.
> > > > > >
> > > > > > Looking forward to hear from you soon.
> > > > > >
> > > > > > Thank you very much.
> > > > > >