Community
Showing results for 
Search instead for 
Do you mean 
Reply

Retrieving value of attribute of custom entity

Accepted Solution Solved
Astute Commentator
Posts: 18
Country: USA
Accepted Solution

Retrieving value of attribute of custom entity

Hi

 

apologies if this has been discussed before but I couldn't find anything when searching through previous posts.

 

I have created a custom entity, created a series of fields and these are saved to the database correctly and I can save data to these fields for contacts...and all seems good with the world Smiley Happy

 

When I created these fields I added attibutes :

 

var field = new FieldDescriptor("Min Weight", "MIN_WEIGHT", descriptor, FieldDataType.Decimal);


field.Attributes[FieldProperty.DecimalPrecision] = new Act.Framework.Database.CurrencyPrecisionAttribute(leftPrecision, rightPrecision);


Framework.Fields.Save(actField);

 

Now I want to get the value of these attibutes, so for instance I want to know the left & right precision of "Min Weight".

 

What is the best method to achieve this?

 

Thanks in advance.

 

 


Accepted Solutions
Solution
Accepted by topic author techno
‎09-25-2015 04:53 AM
Copper Elite Contributor
Posts: 82
Country: Canada

Re: Retrieving value of attribute of custom entity

Something like the following should work

 

Act.Framework.Database.DecimalPrecisionAttribute att = (Act.Framework.Database.DecimalPrecisionAttribute)field.Attributes[FieldProperty.DecimalPrecision];

MessageBox.Show(att.LeftPrecision.ToString());
Ahsan Khalid

Chief Technology Officer
Keystroke Quality Computing Inc.
www.keystroke.ca

View solution in original post


All Replies
Solution
Accepted by topic author techno
‎09-25-2015 04:53 AM
Copper Elite Contributor
Posts: 82
Country: Canada

Re: Retrieving value of attribute of custom entity

Something like the following should work

 

Act.Framework.Database.DecimalPrecisionAttribute att = (Act.Framework.Database.DecimalPrecisionAttribute)field.Attributes[FieldProperty.DecimalPrecision];

MessageBox.Show(att.LeftPrecision.ToString());
Ahsan Khalid

Chief Technology Officer
Keystroke Quality Computing Inc.
www.keystroke.ca

Astute Commentator
Posts: 18
Country: USA

Re: Retrieving value of attribute of custom entity

Thanks Ashan, that worked for me Smiley Happy