Community
Showing results for 
Search instead for 
Do you mean 
Reply

Get custom entity field value

New Member
Posts: 21
Country: USA

Get custom entity field value

Hi,

 

I think I have a simple question. How do I get a value from a custom entity?

 

I have a list:

 

CustomEntityList

<Ticket> tickets = manager.GetCustomEntities(newSortCriteria[] {newSortCriteria(manager.GetCustomEntityFieldDescriptor("TICKET_NUMBER", Act.Framework.MutableEntities.FieldNameType.Alias),ListSortDirection.Descending)});

 

 I would like to know what the TICKET_NUMBER is for the first record returned.

 

tickets[0] will give me an entity, but how do I read the data in the TICKET_NUMBER field?

 

Thanks,

Mike

 

Employee
Posts: 1,163
Country: USA

Re: Get custom entity field value

Hello Mike,

 

Once you have the CustomSubEntityManager you should be able to retrieve a field descriptor from it using it's GetFieldDescriptor method, this will return a DBFieldDescriptor and you can then use it's GetValue method.

Matthew Wood
Act! SDK Support
Community Moderator
New Member
Posts: 21
Country: USA

Re: Get custom entity field value

Hi Matthew,

 

I keep getting an invalid name format error.

 

Should I be using GetFieldDescriptor or GetCustomFirledDescriptor.

 

It looks like I already do that in my first code snippet.

 

Also, for GetValue(), what object do I pass in?

 

Thanks,

Mike

 

Employee
Posts: 1,163
Country: USA

Re: Get custom entity field value

Invalid name format usually indicates the column name is incorrect, your probably using the alias and passing it as a the realName, this is something I often mess up on as well. I usually get the right column name one of two ways, either running the field detail report in the diag, or getting a collection of all the fields first, debugging and looking into the contents of the collection to ensure I'm using the correct column name.

 

I now noticed that you'd already done that, apologies, the way it code pastes in here sometimes makes it hard to read, and I missed it.

 

As for the object to pass in GetValue, if it's a subentity of contacts I think you could pass in the contact record specific to this ticket record.

Matthew Wood
Act! SDK Support
Community Moderator
Copper Contributor
Posts: 10
Country: USA

Re: Get custom entity field value

[ Edited ]

This post helped me with a similar issue.