Cannot define data to send in call activity
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)
destinatarios (List of 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 = ""
And in the "Data in called process" side I have:
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!
COMPLEX type are
java.util.Map. So you must transform your object into a map when assigning it in the call activity:
nombreError:"Notificar a usuario nuevo creación de cuenta",
] // Returns a Map