Community
Showing results for 
Search instead for 
Do you mean 
Reply

How do you remove a Custom Entity? Invalid Object name!

Tuned Listener
Posts: 35
Country: Australia

How do you remove a Custom Entity? Invalid Object name!

I created a custom entity, Attendance with TopLine Designer.

I couldn't see how to remove that entity with the product.

So I did this. Ran without error.

 

private static void DeleteEntity(string p) {

actFwk = GetActFramework();

CustomEntityDescriptor ed = actFwk.CustomEntities.GetCustomEntityDescriptor(p);

FieldDescriptorCollection fds = actFwk.Fields.GetFields(ed);

actFwk.Database.LockDatabase(DatabaseLockReason.SchemaChanges);

foreach (FieldDescriptor fd in fds) {

Console.WriteLine(fd.Name);

if (fd.IsRemovable) {

Console.WriteLine(fd.IsRemovable);

actFwk.Fields.Delete(fd); } }

CustomEntityManager em = actFwk.CustomEntities;

em.DeleteCustomEntity(ed);

actFwk.Database.UnlockDatabase(); }

Now when I try to create a new field with Tools | Create Fields I get this error on Finish.

 

Invalid object name 'dbo.CUST_Attendance'.

 

The is Sql Server error.

It appears the sql table function FNB_Attendance that gets Attendances from dbo.CUST_Attendance has not been deleted.

And that function is causing the error. I recall I had the same error with CUST_Policy demo.

Reece harper

Act! Certified Consultant Australia
http://www.databasepartners.com.au
New Member
Posts: 3
Country: United States

Re: How do you remove a Custom Entity? Invalid Object name!

I don't see a posted reply...did you figure out how to fix the "invalid object" problem?  I am getting the exact same error message and now I can't create new fields.
Copper Contributor
Posts: 98
Country: United States

Re: How do you remove a Custom Entity? Invalid Object name!

If you are looking to delete an entire custom sub-entity table try:

 

		//Syntax not checked - Taken from other code so may need modification
		//Lock Database - Schema Changes
                ActFwk.Database.LockDatabase(DatabaseLockReason.SchemaChanges);

                //Initialize Descriptor
                Act.Framework.CustomEntities.CustomEntityDescriptor attendence = 
                        this.ActFwk.CustomEntities.GetCustomEntityDescriptor("ATTENDENCE");

                //Delete our CustomTables
                ActFwk.CustomEntities.DeleteCustomEntity(attendence);

                //Schema changes made - Unlock Database
                ActFwk.Database.UnlockDatabase();

 

 

 

It looks like the code in the original post just attempts to delete each field (that can be deleted) in a particular custom table but leaving the table itself.

Carlton Jones
Sage Software
New Member
Posts: 3
Country: United States

Re: How do you remove a Custom Entity? Invalid Object name!

Thanks for the reply.  I am an "end user" with limited technical background.  I appreciate the information you posted, but don't know quite what to do with it...
Copper Contributor
Posts: 98
Country: United States

Re: How do you remove a Custom Entity? Invalid Object name!

Karsmichael,

 

I would get in communication with the add-on creator for support.

 

Thanks,

Carlton Jones
Sage Software
New Member
Posts: 3
Country: United States

Re: How do you remove a Custom Entity? Invalid Object name!

Thanks...I already have an email in to them.  After they walk me through the solution I'll post the results here.  Thanks again for taking the time to reply.