You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

How to get the amount of Contacts assigned to an Account

Accepted answer
82
Views
1
Comments
in Sales 1 comment

Summary:

How can I get the amount (count) of Contacts listed for an Account using Groovy?

Content (required):

The current groovy returns the incorrect number of contacts. Expected number is over 30, but only 2 is returned.

Version (include the version you are using, if applicable):


Code Snippet (add any code snippets that support your topic, if applicable):

def voPersonProfile = newView('PersonProfile');
def convc = newViewCriteria(voPersonProfile);
def convcr = convc.createRow();
def convci = convcr.ensureCriteriaItem('PrimaryCustomerId');
convci.setOperator('=');
convci.setValue(PartyId);
convc.insertRow(convcr);
voPersonProfile.appendViewCriteria(convc);
voPersonProfile.executeQuery();
long count = 0;
count = (voPersonProfile.getEstimatedRowCount()+1)

//println('Contacts found: ' + count)
return count;

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!