Showing results for 
Search instead for 
Do you mean 

Opportunity Field Default Value - SDK

Avid Listener
Posts: 44
Country: USA

Opportunity Field Default Value - SDK

because Opportunities use the MutableEntityFieldDescriptor there are no legacy functions to retrieve the Default value, which is not the case for Contact, Companies, that use the former 'FieldDescriptor'


As such getting the default value now has some more steps.


Here is the code for Opportunity field default value


                      Act.Framework.MutableEntities.MutableEntityFieldDescriptor uField2;
                        Act.Framework.MutableEntities.DefaultFieldValueAttribute uFieldDeflt;
                        AttributeCollection uAttcol;
                       string TB1 = "fieldName"

                       uField2 = Classes.Act_Findfunctions.FindOppFieldDesriptor(TB1, this.actApplication);
                        uAttcol = uField2.Attributes;
                        uFieldDeflt =  (Act.Framework.MutableEntities.DefaultFieldValueAttribute)uAttcol[2];
                        string uStr = Convert.ToString(uField2.GetValue(currentRec));
                        if ((uStr == null) | (uStr == "")) { uStr = Convert.ToString(uFieldDeflt.DefaultValue); }
                        this.tbTaxPct.Text = uStr;