Cannot define data to send in call activity

Hello!

I'm using Bonita Community Edition, Version : 2021.1. I have a process A and a call activity that calls process B. Process B receives an input contract (errorInput) with the following structure, based on a bussines variables called "Error":

errorInput (COMPLEX type)

idError (String)
nombreError (String)
tipo (String)
destinatarios (List of String)
ruta (String)

Process A has in its contract (registroInput) some of this data, when I try to define the data to send to the call activity from process A (Execution -> Data to Send, with the "Assigned to Contract Input" option) I have the following on a groovy script in the "Data from root process" side:

def errorVar = new com.company.model.Error()
errorVar .idError = "7"
errorVar .nombreError= "Notificar a usuario nuevo creación de cuenta"
errorVar .tipo = "A"
errorVar .destinatarios = registroInput?.destinatarios
errorVar .ruta = ""
return errorVar

And in the "Data in called process" side I have:

errorInput

When executing the process I get the error: 

Caused by: org.bonitasoft.engine.core.process.instance.api.exceptions.SContractViolationException: Error while validating expected inputs: com.company.model.Error@137f8b1a cannot be assigned to COMPLEX type

I have tried returning a JSON, String, even the same object directly as a variable on process A, also tried "Assigned to Data" option, but still get the same error with some variations.

Really appreciate the help!

Solange Silva

Hi

You can't assigned model type to complex type.

You should try Json data.

Hi,

COMPLEX type are java.util.Map. So you must transform your object into a map when assigning it in the call activity:

eg:

return [
idError:“7”,
nombreError:“Notificar a usuario nuevo creación de cuenta”,
tipo: “A”,
destinatarios:registroInput?.destinatarios,
ruta: “”
] // Returns a Map

HTH
Romain