Object Function Returning Un-Filtered GetEstimatedRecordCount (Doc ID 2032342.1)

Last updated on JULY 21, 2015

Applies to:

Oracle Fusion Sales Cloud Service - Version 11.1.9.2.0 and later
Information in this document applies to any platform.

Goal

The code below is showing all results when the customer would expect it to return a 0, but it consistently returns the number of all opportunities.
The code is for a Formula Field in a Custom Object in the Common Application.

//=================

def thisId = nvl(Contact_Id_c, null) // The PartyId for the associated contact - proven working
def total = 0

if (thisId != null)
{

  def allTrainings = newView('OpportunityVO')
  def criteria = newViewCriteria(allTrainings)
  def critRow = criteria.createRow()

  def thisInstructor = critRow.ensureCriteriaItem('TeamMembers_c') // this field contains all team member PartyIds and their Role_c separated by a space and delimited y semicolons
  thisInstructor.setOperator('LIKE')

  if (role == 'All') // Role is passed via parameter
  {
  
  thisInstructor.setValue('%' + thisId.toString() + '%')
  
  } else {
  
  thisInstructor.setValue('%' + thisId.toString() + ' ' + role + ';%')
  
  }

  criteria.insertRow(critRow)
  allTrainings.appendViewCriteria(criteria)
  allTrainings.executeQuery()
  
  total = allTrainings.getEstimatedRowCount()
}

return total
 

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms