Community
Showing results for 
Search instead for 
Do you mean 
Reply

OpportunityFieldDescriptor problem

Tuned Listener
Posts: 10
Country: Brazil

OpportunityFieldDescriptor problem

Hi All,

 

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( _

            "TBL_OPPORTUNITY.USER6, True).

 

This allways return NOTHING, no matter field from TB_OPPORTUNITY  I use.

 

Does anybody have any tip on this ?

Employee
Posts: 1,163
Country: USA

Re: OpportunityFieldDescriptor problem

[ Edited ]

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

Matthew Wood
Act! SDK Support
Community Moderator
Tuned Listener
Posts: 10
Country: Brazil

Re: OpportunityFieldDescriptor problem

Hi Matthew,

 

 

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 an Opportunity by User6 field
        Dim oField As Act.Framework.MutableEntities.MutableEntityFieldDescriptor = _
            actFM.Opportunities.GetMutableEntityFieldDescriptor("TBL_OPPORTUNITY.USER6", True)
        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
            Return oList
        End If
        Return Nothing
    End Function

 

   Function FindOpportunity(ByVal What As String) As Act.Framework.Opportunities.OpportunityList

   'Looks up  Opportunities by User6 field


        Dim oField As Act.Framework.MutableEntities.MutableEntityFieldDescriptor = _  

                  actFM.Opportunities.GetMutableEntityFieldDescriptor("TBL_OPPORTUNITY.USER6", True)


        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

               Return oList

        End If

 

        Return Nothing

 

    End Function

 

Thanks again for the tip.