UPD:
If your problem still not solved, i can offer you check this topic. In short, you need just transform FileDescription into FileRef as i said before.
Steps:
- Add service task with
SpringBeantype beforeEntityDataTask - Extract your
FileDescriptionand transform it inside spring bean
import io.jmix.bpm.entity.FileDescription; import io.jmix.core.FileRef; import io.jmix.core.FileStorage; import org.springframework.stereotype.Component; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @Component public class ProcessFileManager { private FileStorage fileStorage; public ProcessFileManager(FileStorage fileStorage) { this.fileStorage = fileStorage; } public FileRef saveFileToFileStorage2(FileDescription fileDescription) throws IOException { try (InputStream is = new ByteArrayInputStream(fileDescription.getFileContent())) { FileRef fileRef = fileStorage.saveStream(fileDescription.getFileName(), is); return fileRef; } } } - Put into service task’s method argument your
FileDescription(namedfileVarand marked as process variable) - Publish
ServiceTaskresult as process variable (namedfileRefVarin screenshot)
As i said, you just need to transformFileDescriptionintoFileRef. - Use your new
FileRefby process variable namedfileRefVar
Otherwise, you can use ServiceTask inside of EntityDataTask and taransoform and create necessary Entity insidea SpringBean manually to prevent bpmn schema complication.
If you need more detail explanation/demo, attach your demo project.
Regard, Dmitry
