Add URL TO a form

Good morning ! so I have a process with two human tasks and added two external Forms to em using external URL option. Everything work fine in the portal . My goal is when I start the process outside the portal, I will be able to access the form using a URL containing that specific processeId and taskId, so how to build that URL , how to add it to the form , and what is the format of the Form URL ?

In Firefox, you can find the url of the form by opening the frame in the portal. All you have to do is right-click on the form in portal and select "This Frame" > "Open frame in new tab". I think there's an extension in Chrome that lets you do the same.
In I understand correctly, you would use that form url in an iframe on your external website, is that right?

You could also only use the API to submit the task, but beware of the fact that a task might not be assigned to the user and you might get an error. To correct this, you would need an assign button in your external form and an execute one. You can find these urls here: "https://documentation.bonitasoft.com/bonita/7.10/bpm-api". To assign, you need to pass assigned_id to the json payload of the request and to execute, change the state to completed through the json payload.

I tried it and get "http://localhost:port/bonita/form?displayConfirmation=false&id=160220"

yeah I want to be able to open the form with URL , outside the portal , after starting a case with an external form using "/bonita/API/bpm/process/processId/instantiation " , ii want to be redirected to the form of the task of that new Case , can I use that URL "http://localhost:port/bonita/form?displayConfirmation=false&id=160220" ?

 

Ok, I understand your use case better now. When you instantiate a new process, the new task is not started instantly, you would need to find the new task that was created after you start the process. To do this, what you would do is make a loop that will do an API request to get the tasks associated with the processId (/API/bpm/activity?f=processId='The process id'), until you get at least one. The processId can be found in the response from the instantiation of the process.
After you find at least 1 task that was created by the process, you should have the taskId in the response. After that, you can use it to display the task (I think by default it is something like http://`Host`:`Port`/bonita/portal/resource/taskInstance/`ProcessName`/`ProcessVersion`/`TaskName`/content/?id=`TaskId`&displayConfirmation=false).
Is this the use case that you want to cover?

Just for your information, I don't know where the "http://localhost:port/bonita/form?displayConfirmation=false&id=160220" would come from, what did you do to find that url?

well what I ave tried to do after making the post request Of /instantiation , I sent another request using this URL "/bonita/API/bpm/userTask?c=2&p=0&f=caseId={caseId}" but its getting just one task (the first one of the process) and I made e redirection to thee URL form http://localhost:port/bonita/form?displayConfirmation=false&id=160220" after retrieving the taskId from the previous request response , and then when I try to submit the first form of that task , I don't know how to go to the next task "I tried "/bonita/API/bpm/userTask?c=2&p=0&f=caseId={caseId}" but it gives me the same Task and the same taskId that I'm trying to execute , not the next one , any solution ?

Could you try adding a second filter to that request that filters by state ( &f=state=ready )?
I'm also asking myself if it might be a cache problem.

yess I did and its getting all the ready tasks , and then I added e filter for caseId , its showing an array with the ready tasks in the portal

I don't know how to delete messages on this forum, I'll probably ask someone later on how to do it.
Just for me to understand "/bonita/API/bpm/userTask?c=2&p=0&f=caseId={caseId}&f=state=ready", still gives you the first task and doesn't give you the second task in the process? What happens if you call the same API after 5-10 seconds?

No it gives me the list of the tasks !

"http://localhost:port/bonita/form?displayConfirmation=false&id=160220" get it when I did right-click on the form in portal and select "This Frame" > "Open frame in new tab", isn't that url im gonna use to show the form?

Yes, that should be the url that you use. Also, I don't know if you can search a task through the userTask API, I would try using the humanTask API.

My goal is to assure that i have a navigation between the two external forms that belong to my 2 human task, but l dont want it through the Portal, but through my frontend app thats why I needed the urls and the other stuff.

What about the form API,  when can i use it "/form/mapping "? Can you explain it for me?

I understand that you want to make a transition between the 2 human tasks, and if I understood you correctly, you seem to have a problem with getting the id of the 2nd task after you complete the 1st one. Am I correct?
Do you also have a problem with redirection to the portal after you complete the 1st task? Did I understand that correctly?

Yeah thats it ! Redirection to the second form after executing the first one ! And thats supposed To be happening outside the Portal home page thats why I need the urls To make it work in my frontend application 

Ok, so, if I understand this correctly, you have the id of the second task and you just need the URL of the 2nd task. Did I understand that correctly?

After executing the first task , I added a call to the request `/bonita/API/bpm/humanTask?c=50&d=rootContainerId&f=state%3Dready&f=caseId=${caseId}` to get the ready tasks filtered by the caseId , and in the response I should be getting the ready task so from that response I could get The id of the task and then injecting it in my URL http://localhost:port/bonita/form?displayConfirmation=false&id={{taskId}}" to be redirected to the form of my second form , but it seems that I always get empty response even when I check in the portal , the Task exists , Thats the issue 

This seems very strange indeed, could you look at the API call that is made when executing the first task, is it " API/bpm/userTask/{taskId}/execution "? Does it have no content? Does it return a 204?

yes it returns 204 !

I have a question ! How to refresh the task list in the portal without pressing the refresh button Next to Task List ?