Community
Showing results for 
Search instead for 
Do you mean 
Reply

Custom Entity to Company, Contact AND opportunity

Astute Commentator
Posts: 6
Country: Belgium

Custom Entity to Company, Contact AND opportunity

I looked at the sample codes, and I can't figure it out.

Is it possible to add one Custom Table and attach it to the Contacts as well as the Companies and the Opportunities or would I have to make 3 tables in my case?

This is the error I get:

This custom sub-entity is not a sub-entity of companies Parameter name: company

The parent is indeed Contacts.

 

 

The sample codes are confusing because they let me think that one Custom Table can be attached multiple ACT!entities:

 

             ICompanyDetailView icodv = e.View as ICompanyDetailView;
            if ( icodv != null && !loadedTabs.ContainsKey(ParentEntity.Companies) )
            {
                if ( (CustomSubEntityDefinition.PARENT_ENTITY & ParentEntity.Companies) == ParentEntity.Companies )
                 {
                     loadedTabs[ParentEntity.Companies] = null;
                     this.AddTabToDetailView(ParentEntity.Companies);
                 }
            }

            IOpportunityDetailView iodv = e.View as IOpportunityDetailView;
            if (iodv != null && !loadedTabs.ContainsKey(ParentEntity.Opportunities))
            {
                if ((CustomSubEntityDefinition.PARENT_ENTITY & ParentEntity.Opportunities) == ParentEntity.Opportunities)
                {
                    loadedTabs[ParentEntity.Opportunities] = null;
                    this.AddTabToDetailView(ParentEntity.Opportunities);
                }
            }

 

Thank you very much!

Nickel Elite Contributor
Posts: 937
Country: USA

Re: Custom Entity to Company, Contact AND opportunity

I believe the API only supports identification of one parent entity within a custom sub entity.

 

That doesn't prevent you from adding columns in your sub entity which are the foreign keys of those other entities.  You'd have to manage those key pair values in your code, but that shouldn't keep you from using data from that sub entity in other entity views.

 

If your sub entity was "Cool_Stuff" and parent was Contact, and your columns were

cool_Stuff ID, ContactID, description, opportunityid, companyID

 

Then you could create a control for Opportunities or Company that filtered the sub entity results by the current record's ID.

 

Is this what you're trying to do?