How To Convert String To Base 64 Value In Groovy Script to pass it as input of a WS long text field (Doc ID 1966529.1)

Last updated on MARCH 10, 2015

Applies to:

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


Need to set long text fields through Groovy scripting using web service.
Tried to set the string as input value for long text fields in web service, but when invoking the service, getting Server 2 errors.
The input has to be converted into base 64 mode for this long text fields, so using the following groovy script:

 def s = nov_exception.NOV_ErrorMessage
 String encoded = s.bytes.encodeBase64().toString()
 def objectName = "NOV_ArchiveMessages_c";
 def object = [:];
 object = [
  NOV_ObjectName_c : nvl(nov_exception.NOV_ObjectName,"NA"),
  NOV_ObjectLevel_c : nvl(nov_exception.NOV_ObjectLevel,"NA"),
  NOV_ErrorCode_c : nvl(nov_exception.NOV_ErrorCode,"NA"),
  NOV_ErrorMessage_c : nvl(encoded, " "),
  //NOV_MessageSent_c : nvl(nov_exception.NOV_MessageSent,"NA"),
  //NOV_MessageReceived_c : nvl(nov_exception.NOV_MessageReceived,"NA"),
  NOV_Source_c : nvl(nov_exception.NOV_Source,"NA"),
  NOV_Target_c : nvl(nov_exception.NOV_Target,"NA"),
  NOV_ObjectId_c : nvl(nov_exception.NOV_ObjectId,"NA"),
  NOV_InterfaceName_c : nvl(nov_exception.NOV_InterfaceName,"NA")
 def response = adf.webServices.NOV_Common_Custom_Object_Service.createEntity(object, objectName)


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 hundreds of Community platforms