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 fetch multiple values through view criteria using groovy

edited Mar 1, 2021 9:08AM in Fusion Service 5 comments

Content

Hi Team,

I want to fetch a field's value through view criteria sript when the condition satisfies. As of now, I can get a single value and below is the example:

I want to get all Open SR numbers created against the customer "Chalhoub group" and set those value into a field. From the below script I can able to print only a single record but the count for the particular search is more than 20. Please guide me if anyone aware of this.

 

Thanks,

Shaheela

Version

21A

Code Snippet

def account = "Chalhoub group"
def srno = SrNumber

def ServiceRequestVO = newView('ServiceRequestVO')
def vc = ServiceRequestVO.createViewCriteria()
def vcrRow = vc.createRow()
def vcFilter1 = vcrRow.ensureCriteriaItem('AccountPartyUniqueName')
vcFilter1.setOperator('=')
vcFilter1.setValue(account)

def vcFilter2 = vcrRow.ensureCriteriaItem('StatusCd')
vcFilter2.setOperator('<>')
vcFilter2.setValue('ORA_SVC_RESOLVED')

def vcFilter3 = vcrRow.ensureCriteriaItem('StatusCd')
vcFilter3.setOperator('<>')
vcFilter3.setValue('ORA_SVC_CLOSED')

vc.insertRow(vcrRow)
ServiceRequestVO.appendViewCriteria(vc)
ServiceRequestVO.executeQuery()
int count = 0
count = ServiceRequestVO.getEstimatedRowCount()
//setAttribute('ProblemDescription',count)
if (ServiceRequestVO.hasNext()) {
  def ServiceRequestRow = ServiceRequestVO.next()
  def srnum = ServiceRequestRow.getAttribute('SrNumber');  
  setAttribute('ProblemDescription',srnum)
}

Howdy, Stranger!

Log In

To view full details, sign in.

Register

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