How to get a document of a pool in a subprocess ?

1
0
-1

Hi everyone, I have a document declared in my pool, and i want to get this document in a subprocess of this pool. I tried some weird things to do this with groovy scripts, but not really successful. Someone can explain me how to do this ?

Cheers.

PS: I'm working on Bonita 6.2.5

4 answers

1
+4
-1
This one is the BEST answer!

Hi Fabien. The most simply way to achive your goal is the following: 1. add a document instance in the main process. let's call it "mainDoc" 2. add a document instance in sub.process. let's call it "subDoc" 3. in the call activity add a task Long variable (docId) that will contain mainDoc ID. add this code to store the value in the variable default value

apiAccessor.getProcessAPI().getLastDocument(processInstanceId, "mainDoc").getId();
  1. add a Long variable in sub-process. (sub_docId)
  2. map the docId with sub_docId using mapping feature in call activity
  3. add an automatic task as first task in sub_process that will get the mainDoc, create a new DocumentValue and assign it to subDoc. Let me exaplaine more in details: add a new operation in the automatic task.
import org.bonitasoft.engine.bpm.document.Document;
import org.bonitasoft.engine.bpm.document.DocumentValue;

Document doc=apiAccessor.getProcessAPI().getDocument(sub_docId);
DocumentValue docValue=new DocumentValue(apiAccessor.getProcessAPI().getDocumentContent(doc.getContentStorageId()), doc.getContentMimeType(), doc.getContentFileName());
return docValue;

use "Set document" as kind of operation and assign it to subDoc.

That's all. Let me know if it solve your problem. Ciao

Comments

Submitted by fabien.puchol on Wed, 04/09/2014 - 17:18

Thanks a lot domenico, that works. Bye.

Submitted by mobf.ctb on Mon, 10/13/2014 - 21:24

Hello, gentlemens

I don't understand where I do the assignment. I followed the instructions and doesn't worked. When I tried to assign the script to the SubDoc appeared the message that the variables are incompatible.

Best Regards Mario Borges

Submitted by foufoukahloun on Wed, 01/20/2016 - 00:45

can you help me pleaseeeeeee because I have found the same problem ![image][image]
https://www.dropbox.com/s/gvmz664pl141ilp/Capture1.PNG?dl=0

https://www.dropbox.com/s/heiwceva26z0j64/Capture2.PNG?dl=0

Submitted by antoine.mottier on Fri, 01/22/2016 - 12:10

You can get the working example here: https://github.com/Bonitasoft-Community/parent-child-shared-document/rel...

Note that in your case issue is that return type of the Groovy script expression is set to java.lang.String instead of org.bonitasoft.engine.bpm.document.DocumentValue

Submitted by fabien.puchol on Wed, 04/09/2014 - 17:18

Thanks a lot domenico, that works.
Bye.

Submitted by foufoukahloun on Sat, 01/23/2016 - 14:14

Thanks a lot antonie, this example works.
thanks you verry much for your help
Bye.
Faouzia

1
+1
-1

Hi, that's nice it works if i am managing with a single document but if i am managing multiple variable that's does not work. any solution?

1
0
-1

Pardon, j'ai pas trouvé "Assigned to data", j'ai seulement "Associé à la variable" ou "Associé a l'input du contrat".
et est ce que je suis le même démarche pour le fichier ou quoi?
En fait dans le fichier ci_joint: https://www.dropbox.com/home?preview=url-1.0.bos un simple exemple que j'ai développé, est il possible de montrer ce que je demande sur mon exemple? ou donner moi un exemple que je le suivre? Merci pour votre aide.

Cordialement;

1
-2
-1

Bonjour,

Je travaille sur Bonita 6.2.5 , n'étant pas encore très avancée dans mon projet.

En effet, je ne vois pas comment définir un sélecteur d'acteur, comme dans Bonita 5.10, et de même je n'arrive pas à créer des acteurs.

Quelqu'un peut-il m'aider?

Merci d'avance.

Comments

Submitted by domenico.giordano on Wed, 04/09/2014 - 18:05

Hi. Could you open a new question? This is related to completly different topic. I'll be able to give you an answer asap. Ciao.

Submitted by foufoukahloun on Wed, 01/20/2016 - 00:47

j'ai entrain de tester cette solution sur bonita 6.3.1 en fait j'ai besoin de transfert des fichiers entre deux pool
toujours un message de comptabilité pour 3eme etape
je pense le problème dans le type de retour ,qu'est ce que je dois mettre comme valeur de retour pour cette fenêtre
https://www.dropbox.com/s/gvmz664pl141ilp/Capture1.PNG?dl=0

https://www.dropbox.com/s/heiwceva26z0j64/Capture2.PNG?dl=0

SVP urgentttttttt aider moi pour que je puisse avancer dans mon travail
merci d'avance

Submitted by foufoukahloun on Wed, 01/20/2016 - 16:04

Please can you help me for my example
https://www.dropbox.com/s/7b350b25cdan99h/fichier_lettre-1.0.bos?dl=0

thank you so much

Submitted by antoine.mottier on Fri, 01/22/2016 - 12:12

I shared a solution that is compatible with Bonita BPM 7.1.5.

I would highly recommend to upgrade from version 6 to version 7 in order to benefit from v7 new features.

Submitted by foufoukahloun on Sat, 01/23/2016 - 12:50

merciii bien antoine pour votre aide;
donc je pense que mon problème que la solution est incompatible avec mon projet qui a été réalisé en 6.3.1
je pourrai faire une mise a jour de mon version vers 7.1 et je veux essayer une autre fois cette solution
merci beaucoup pour votre aide
cordialement
faouzia .kh

Submitted by azouzisameh on Thu, 03/03/2016 - 22:42

Comment je fait dans le cas de transfert d'une adresse URL entre deux pool?

Submitted by antoine.mottier on Mon, 03/07/2016 - 15:58

Une URL peut être traitée comme une donnée de type texte.

Si cette information est stockée dans une business data les deux pool doivent déclarer une référence à la business data. Dans le mapping des données (configurer sur la call activity) il faut utiliser l'option "Assigned to Data".

Submitted by azouzisameh on Mon, 03/07/2016 - 20:37

Pardon, j'ai pas trouvé "Assigned to data", j'ai seulement "Associé à la variable" ou "Associé a l'input du contrat".
et est ce que je suis le même démarche pour le fichier ou quoi?
En fait dans le fichier ci_joint: https://www.dropbox.com/home?preview=url-1.0.bos un simple exemple que j'ai développé, est il possible de montrer ce que je demande sur mon exemple? ou donner moi un exemple que je le suivre? Merci pour votre aide.

Cordialement;

Submitted by antoine.mottier on Tue, 03/08/2016 - 10:08

"Associé à la variable" est l'option à utiliser. Si cela ne fonctionne pas je pourrais étudier votre exemple.

Cordialement

Submitted by azouzisameh on Tue, 03/08/2016 - 15:18

oui, c'est déja dans le cas d'un fichier j'ai travaillé avec "Associé à la variable" est cela bien fonctionné, mais si je couche URL, ne fonctionne pas.
Je travaille sur 7.1 mais j'utilise (6.x Application) pour les interface graphique et non pas UI designer.
Si nn, j'ai pensé de mettre cette url dans une zone de texte dans POOL1 par la suite je le récupère dans POOL2 aussi dans une zone texte mais ce texte est "cliquable". est ce que c'est possible ou nn? si oui comment je peux le faire?
Cordialement.

Submitted by antoine.mottier on Mon, 03/14/2016 - 13:18

Le lien que vous avez partagé ne donne pas accès au fichier. Est ce que vous pouvez me fournir le lien de partage du fichier ?

Notifications