My Oracle Support Banner

How to return result from List in multiple lines using groovy? (Doc ID 2433758.1)

Last updated on AUGUST 10, 2018

Applies to:

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

Goal

How to return result from List in multiple lines using groovy?
 

The following code was used  to return the contact email addresses into a custom formula field. The requirement is to display the result in multiline.

////////////////////////////////////////////////////////
def emailiter = Email;
def EmailList = []
def var_inv = Email
while(var_inv.hasNext()){
def row_access = var_inv.next()

if (row_access.PrimaryFlag == 'N')

{def Liste = row_access.EmailAddress
EmailList.add(Liste+ "\n") }
}
if(EmailList != null){
def string_val = substringAfter(substringBefore(EmailList.toString(),']'),'[')
def string = string_val.replaceAll(',','');

return string
} else return ""
///////////////////////////////////////////////////////////////////////
Result : email1@gmail.com email2@gmail.com
/////////////////////////////////////////////////

Expected Result:

email1@gmail.com
email2àgmail.com

Solution

To view full details, 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 a vibrant support community of peers and Oracle experts.