Groovy 33- In a Formula Field Arrange Selected Items of a Multiselect List one Under another

We have a Multi Select Fix Choice List  and we want to take all the items that get  selected and arrange them one under another in a formula field.

This is the formula field code.

Note: It has to be  a Text formula Field

def  result= []    
def string_val    
  
def v_displayValues = getSelectedListDisplayValues(‘<API FCL>’)    
if(<API FCL>!=null){    
for(int i = 0 ; i<v_displayValues.size();i++)    
{    
  if(i == 0)  
  result.add(” “+v_displayValues[i]+“\n”)  
  else  
  result.add(v_displayValues[i]+“\n”)    
}    
string_val = substringAfter(substringBefore(result.toString(),‘]’),‘[‘)    
  
  
}    
else    
{    
  string_val = “”    
}    
def newString = string_val .replaceAll(‘,’,)   
return newString  

Where <API FCL> is the API name of your Multiselect Fix Choice List

Leave a Reply

Your email address will not be published. Required fields are marked *