11-02-2011 03:41 AM
I know how tto setvalues easy enough
var opp = ActApplication.ApplicationState.CurrentOpportunity;
var aaa = ActApplication.ActFramework.Opportunities.GetFieldDescriptor("TBL_OPPORTUNITY.USER3");
but gettiing a field value as been hard, and I its not the same for contacts...
Has anyone got examples, As Im trying to get user3 fields
11-02-2011 07:08 AM
Apologies if you spent a lot of time on this, it's an old defect that still pending resolution. In the meantime you can get the value of an opportunity field with a MutableEntityFieldDescriptor, like so:
MutableEntityFieldDescriptor mefd = _ActApp.ActFramework.Opportunities.GetMutableEntityFieldDescriptor(StandardOpportunityField.User3); object ob = mefd.GetValue(o);
11-02-2011 02:01 PM
Because Im not the best programmer, I still get error message because these objects are not declared,
I get the 2 rerror messages
The first one do I need to bring in another class ?
Error 1 The type or namespace name 'MutableEntityFieldDescriptor' could not be found (are you missing a using directive or an assembly reference?)
and Error 2 The name 'o' does not exist in the current context
The next Im struggling to get the object and assign it to a string, In the contact table, we had a heap of examples that allow basic programers to copy abd try, is their a snipit code that copys user1 field to user2 field ... As not much in the sales oppp table
11-03-2011 06:37 AM
Not a problem.
Yes, the first error is being thrown because you either lack a reference to Act.Framework.MutableEntities or you have the reference but lack the using statement. Add the reference and using statement and that error should go away.
The second I should apologize for, I included a variable but not the section of code that initialized it:
Opportunity o = ActApplication.ApplicationState.CurrentOpportunity;
The easiest way to convert it from an object to a string is to call the ToString method:
string str = mefd.GetValue(o).ToString();
To then assign the value to user2, you simply get the field descriptor for user2, call it's set value method. The psuedo code would look something like this:
11-03-2011 12:39 PM
Thank you so much for that
You have made an old part time VB 6/SCript programmer happy,
Dam it .net is hard
but Im getting there, That work nicely