AnsweredAssumed Answered

Groovy error

Question asked by daniel.schlup601649 on Feb 28, 2017
Latest reply on Mar 1, 2017 by ManuThommes7331

I am not clear about why do I get an error in Boomi on the following piece of sample Groovy script:

 

def country = "US";
def postalCode = "852244225";
if (country == "US") {
  if (postalCode.length() > 5) {
    output = postalCode.take(5) + '-' + postalCode.drop(5);
  } else {
    output = postalCode;
  }
}

 

Embedded message: [Function: Scripting]: Error executing custom script: No signature of method: java.lang.String.take() is applicable for argument types: (java.lang.Integer) values: {5} (in groovy script); Caused by: No signature of method: java.lang.String.take() is applicable for argument types: (java.lang.Integer) values: {5} (in groovy script); Caused by: No signature of method: java.lang.String.take() is applicable for argument types: (java.lang.Integer) values: {5}

 

Does this mean that Boomi supports only a subset or maybe an older version of Groovy not supporting the take() method (if so then where can I see what is actually supported)? This works fine when putting it into e.g. Groovy web console.

 

Regards,

Daniel

Outcomes