Community
Showing results for 
Search instead for 
Do you mean 
Reply

How do i getvalue() for a sales Opp in user3 etc etc

Tuned Listener
Posts: 35
Country: Australia

How do i getvalue() for a sales Opp in user3 etc etc

I know how tto setvalues easy enough

 

var opp = ActApplication.ApplicationState.CurrentOpportunity;

var aaa = ActApplication.ActFramework.Opportunities.GetFieldDescriptor("TBL_OPPORTUNITY.USER3");

aaa.SetValue(opp,"3232332");

opp.Update();

 

 

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

 

cheers Reece              

Reece harper

Act! Certified Consultant Australia
http://www.databasepartners.com.au
Employee
Posts: 1,163
Country: USA

Re: How do i getvalue() for a sales Opp in user3 etc etc

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);

 

Matthew Wood
Act! SDK Support
Community Moderator
Tuned Listener
Posts: 35
Country: Australia

Re: How do i getvalue() for a sales Opp in user3 etc etc

thanks,

 

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

 

Reece harper

Act! Certified Consultant Australia
http://www.databasepartners.com.au
Employee
Posts: 1,163
Country: USA

Re: How do i getvalue() for a sales Opp in user3 etc etc

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:

 

user2MEFD.SetValue(opportunity1, mefd.GetValue(o))

 

Matthew Wood
Act! SDK Support
Community Moderator
Tuned Listener
Posts: 35
Country: Australia

Re: How do i getvalue() for a sales Opp in user3 etc etc

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

 

 

Reece harper

Act! Certified Consultant Australia
http://www.databasepartners.com.au