Community
Showing results for 
Search instead for 
Do you mean 
Reply

Contact custom entitites

fgh
New Member
Posts: 12
Country: Estonia

Contact custom entitites

Is ther a way to get custom entities for a contact record. Lets call the contact:Nick Davies. this contact has an ID:"as4324324asda".

I have a custom table called Novels. Is there a way to get all the novels for contact Nick Davies?

Bronze Super Contributor
Posts: 1,231
Country: USA

Re: Contact custom entitites

Use the Entity Manager

 

Me.EntityList = Me.EntityManager.GetCustomSubEntities(Me.ACTApplication.ApplicationState.CurrentContact, Me.EntitySortCriteria, Me.FilterCriteriaACT)

 

 

-- Jim Durkin

 

fgh
New Member
Posts: 12
Country: Estonia

Re: Contact custom entitites

Thanks , that did work!

Tuned Listener
Posts: 4
Country: Canada

Re: Contact custom entitites

Hi Jim,

Can explain the code bit more, I have see the class Entity Manager has no method as the GetCustomSubEntities and also what do you refer for the Me in the code
Me.EntityList = Me.EntityManager.GetCustomSubEntities(Me.ACTApplication.ApplicationState.CurrentContact, Me.EntitySortCriteria, Me.FilterCriteriaACT)
Copper Super Contributor
Posts: 86
Country: United_Kingdom

Re: Contact custom entitites

[ Edited ]

venkatinfy wrote:
Hi Jim,

Can explain the code bit more, I have see the class Entity Manager has no method as the GetCustomSubEntities and also what do you refer for the Me in the code
Me.EntityList = Me.EntityManager.GetCustomSubEntities(Me.ACTApplication.ApplicationState.CurrentContact, Me.EntitySortCriteria, Me.FilterCriteriaACT)

Hi venkatinfy,

 

This is how I get custom sub-entities for a Contact (C#).

I have taken this out of an older project of mine so I haven't re-tested it, but it certainly worked at the time and might prove useful to you.

 

You should have your SubEntity defined somewhere in your project. Yours may look a little different, but mine looks like this (SubEntity.cs):

 

public sealed class MyCustomEntity : CustomSubEntity
{
    public MyCustomEntity(CustomSubEntityInitializationState state)
        : base(state) { }
}

Then I retrieve the entity like this (Main.cs):

 

Contact MyContact = ... // However you get your Contact goes here

CustomEntityDescriptor MyEntityDescriptor = actApp.ActFramework.CustomEntities.GetCustomEntityDescriptor("MyCustomEntity");

CustomSubEntityManager<MyCustomEntity> MyEntityManager = actApp.ActFramework.CustomEntities.GetSubEntityManager<MyCustomEntity>(MyEntityDescriptor);

CustomEntityList<MyCustomEntity> MyCustomEntityList = MyEntityManager.GetCustomSubEntities(MyContact, null);

There's a good sub entity sample that you can look at if you haven't already.

It's in C# and for desktop, but shows you how to store and retrieve custom entities.

 

http://community.act.com/t5/Act-Developer-Downloads/Custom-Sub-Entity-Sample/td-p/307

 

I unfortunately don't have any Act! for Web samples to share with you.

 

Hope this helps!

 

Sam.

____________________________________________________________

Unfortunately I no longer work for Swiftpage International. Please do not send any queries to this account.
Tuned Listener
Posts: 4
Country: Canada

Re: Contact custom entitites

Hi Sam,

Thanks for the help, I was able to retrieve the custom entity fields with the help of above information.