Community
Showing results for 
Search instead for 
Do you mean 
Reply

Opportunity Rows

Accepted Solution Solved
Copper Contributor
Posts: 61
Country: United_Kingdom
Accepted Solution

Opportunity Rows

Hello everyone,

 

I found my way to get selected opportunities and some of its fields but now I'm trying to access all the fields by mean rows on this selected opportunity I'm trying to do it from fields property but gives me "Parameter Name:realName" error. Any ideas about this.

 

Thanks. 


Accepted Solutions
Solution
Accepted by topic author hysezer
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 32
Country: United_Kingdom

Re: Opportunity Rows

yeh, my bad. For the values I think you want the mutableentityfielddescriptors

 

something alogn the lines of

MutableEntityFieldDescriptor[] oppfielddecriptors = framew.Opportunities.GetMutableEntityFieldDescriptors();

would do the trick.

 

so the below would, I think get the values for all fields for the current opportunity. Obviously, you'd use it differently, it's just an example. Also, you can set the opportunity object by getting the needed opportunity in another way, etc.

 

 Opportunity o = application.ApplicationState.CurrentOpportunity;

foreach (MutableEntityFieldDescriptor field in oppfielddecriptors)
             {
                 string value = Convert.ToString(field.GetValue(o));
             }

View solution in original post


All Replies
Employee
Posts: 1,163
Country: USA

Re: Opportunity Rows

Is there a particular field that you're trying to get? Have you verified that you're using the correct real name for the field? 

 

This worked for me:

 

Opportunity myOpp = _ActApp.ApplicationState.CurrentOpportunity;
DBFieldDescriptor dbf = _ActApp.ActFramework.Opportunities.GetFieldDescriptor("TBL_OPPORTUNITY.USER1");

Matthew Wood
Act! SDK Support
Community Moderator
Copper Contributor
Posts: 61
Country: United_Kingdom

Re: Opportunity Rows

[ Edited ]

Hello Matthew thank you for your reply I'm trying to get all the fields so I need their real names I think, where can I find them ? Find them Matthem thank you very much for your help..

Copper Contributor
Posts: 32
Country: United_Kingdom

Re: Opportunity Rows

if you have the opportunity object you can get all the fields for it into a fieldcollection. Here's some code from something i'm working on

 

 Opportunity o = application.ApplicationState.CurrentOpportunity;
           MutableEntity.FieldCollection oppfields = o.OpportunityFields;

 

you could potentially loop through these, etc.

Copper Contributor
Posts: 32
Country: United_Kingdom

Re: Opportunity Rows

Also, I'm not sure why but i found that

MutableEntityFieldDescriptor (and GetMutableEntityFieldDescriptor) worked better with opportunities in particular.

 

Also, you don't necessarily need real names - you can use the GetMutableEntityFieldDescriptor(name, fieldNameType) overload and pass the display name with fieldnametype.alias or fieldnametype.display

 

Copper Contributor
Posts: 61
Country: United_Kingdom

Re: Opportunity Rows

Hello Anton,

 

Thanks for the reply I'm trying your code as well but now my problem is I can get to the column names but I can't find the values inside the rows such as I found column name Company Name but I can't find the companies name in row like Microsoft. Could you post your complete code here?

 

Thanks 

Solution
Accepted by topic author hysezer
‎09-25-2015 03:20 AM
Copper Contributor
Posts: 32
Country: United_Kingdom

Re: Opportunity Rows

yeh, my bad. For the values I think you want the mutableentityfielddescriptors

 

something alogn the lines of

MutableEntityFieldDescriptor[] oppfielddecriptors = framew.Opportunities.GetMutableEntityFieldDescriptors();

would do the trick.

 

so the below would, I think get the values for all fields for the current opportunity. Obviously, you'd use it differently, it's just an example. Also, you can set the opportunity object by getting the needed opportunity in another way, etc.

 

 Opportunity o = application.ApplicationState.CurrentOpportunity;

foreach (MutableEntityFieldDescriptor field in oppfielddecriptors)
             {
                 string value = Convert.ToString(field.GetValue(o));
             }

Copper Contributor
Posts: 61
Country: United_Kingdom

Re: Opportunity Rows

Thank you very much Anton that really do the trick, much appriciated.