07-07-2010 02:28 PM
I need to do an opportunity lookup based in the field USER6.
To do that, I'm using the GetOpportunities method, so the statement look like this:
Return actFM.Opportunities.GetOpportunities(SortCriteria, IfilterCriteria)
To create the IFilterCriteria I need the opportunityFieldDescriptor for the field USER6, so I'm using
Dim oppfdName as OpportunityFieldDescriptor = actFM.Opportunities.GetOpportunityFielsDescriptor( _
This allways return NOTHING, no matter field from TB_OPPORTUNITY I use.
Does anybody have any tip on this ?
07-08-2010 06:26 AM - edited 07-08-2010 07:03 AM
I think this post may be helpful, also doing it as a lookup will make it possible to capture the IOpportunitySource incase you need to set the lookup programmatically.
An after thought I had, opportunities use MutableEntityFieldDescriptor
07-08-2010 08:18 AM
Thanks a lot, MutableEntityFieldDescriptor did the trick.
Below is the working code to find an opportunity based in a USER field, in case it can help someone with the same issue.
Function FindOpportunity(ByVal What As String) As Act.Framework.Opportunities.OpportunityList
'Looks up Opportunities by User6 field
Dim oField As Act.Framework.MutableEntities.MutableEntityFieldDescriptor = _
If Not oField Is Nothing Then
'Create the lookup
Dim lookup As Act.Framework.Lookups.OpportunityLookup
lookup = actFM.Lookups.LookupOpportunitiesReplace(What, Act.Framework.Lookups.OperatorEnum.EqualTo, oField)
'execute the lookup
Dim oList As Act.Framework.Opportunities.OpportunityList = lookup.GetOpportunities(Nothing)
'return the list
Thanks again for the tip.