[Bonita 7.1.0] Access problems (form through link sent by e-mail)

Hello everybody!
I currently have a process using 2 sub-processes. In a few words, my process will read e-mails coming from SalesForce, and dispatch it in 2 categories (Weblink and Severity). Each category mail is sent to a different sub-process.

Everything is working fine, except one thing :

  • I have a form when the mail is a Severity mail. So I have a step which will generate a **link **to this form, and send it by e-mail to concerned people. Here is the code to generate the link :
String host = portalURL; String port = portalPort; //Don't forget to update task variable if the Step name is changed String task = "Approve Severity"; String encodedTask = URLEncoder.encode(task,"UTF-8");

StringBuffer buffer = new StringBuffer(“<a href="”);
buffer.append(portalProtocol);
buffer.append(host);
buffer.append(“:”);
buffer.append(port);
buffer.append(“/bonita/portal/form/processInstance/”)
buffer.append(processInstanceId)
buffer.append(“/task/”)
buffer.append(encodedTask)
buffer.append(“">here”)

return buffer.toString();

  • Then, in my form step, I have created a single-user filter (only one account in the company can approve Severity), here is the code :
import org.bonitasoft.engine.identity.User;

User user = apiAccessor.getIdentityAPI().getUserByUserName(“tarotg”);

return user.getId();

  • This seems to work, because I can see the task has been assigned to myself in Bonita portal. BUT, when i click on the link, I only have access to an “Overview Page”, as if I haven’t rights on the form :

Hebergeur d'image

-When accessing to the form via Bonita Portal, everything is fine, the Task is present int Tasks List and the form is correctly displayed when performing the task :

Hebergeur d'image

I noticed in Engine logs that I have some warnings when logging :
2016-03-21 10:21:41.352 +0100 org.bonitasoft.console.common.server.login.datastore.LoginDatastoreExt org.bonitasoft.console.common.server.login.datastore.LoginDatastoreExt login INFO: Impossible to login on the engine API : No user or password 2016-03-21 10:21:41.352 +0100 org.bonitasoft.console.common.server.login.datastore.LoginDatastoreExt org.bonitasoft.console.common.server.login.datastore.LoginDatastoreExt login INFO: Error while logging in the engine API: javax.security.auth.login.LoginException: Impossible to login on the engine API : No user or password 2016-03-21 10:21:49.183 +0100 com.bonitasoft.engine.api.impl.ServerAPIExt org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl log WARNING: THREAD_ID=119 | HOSTNAME=DES0007 | TENANT_ID=1 | The API method org.bonitasoft.engine.api.ProfileAPI.getProfilesForUser is deprecated. It will be deleted in a future release. Please plan to update your code to use the replacement method instead. Check the Javadoc for more details.

Do you have any idea why it’s not working? Is there a bug with sub-processes and actors? Or am I sending a wrong link?

Thanks for your help!

StringBuffer buffer = new StringBuffer(" buffer.append(portalProtocol);

is wrong…

should be something like:

StringBuffer buffer = new StringBuffer(); buffer.append(portalProtocol);

however,

You’re not signing in…I think your session needs to login first, then go to the form.

regards
Seán

PS: If this reply answers your question, please mark a resolved.

Hi Sean!

I just saw that “error”. Indeed it’s just the forum that deletes <a href=".
So here is my real code :

Hebergeur d'image

In addition, I am logged into Bonita Portal. When I click on the link received by e-mail, I have to login (but I have these logs…)

First things first to show code correctly you can do this…

< code >
your code/log data
< / code >

remove the spaces between the <> though and it comes out like mine.

Regarding the link, I know you can see you are logged in but I don’t think you are.

Let me explain:

  1. You login to the portal and a session is created
  2. You execute your process and an email link is sent
  3. You receive the email and click the link
  4. Which opens a browser session and you get the above error

And it is point 4 where the browser session is created that does not recognize the previously signed in session.

You have to go to a page where it will log you in and then show the page you want.

I tested this with Chromes Advanced REST Client and found this to be true… :frowning:

regards
Seán

PS: If this reply answers your question, please mark a resolved.

Thanks for the code tag, I didn’t know it! (Why is it not in this website buttons?)

In fact, Bonita asks me to log in each time I click on the link (no matters if I was connected before).

Where does that error comes from? I will have to disconnect then reconnect each time I have to access this form?

I never had this, even if I have other processes with exactly the same access from a link…

Yep, in 6 it worked exactly the way you wanted it to…

In 7 though it doesn’t… :slight_smile: :slight_smile: :slight_smile:

Which is a problem.

I need to understand this as well. Let me think.

regards

I understand. What’s disturbing is that my other processes created with Bonita 7.1.0 works…

Tell me if you need some logs or other things to investigate!

Hi,
ist there already an answer for this issue? Because I have the same problem with version 7.2.3. I want to generate a link to a task in an email but without showing the whole portal. Just the ui form.
Is that possible with version 7.x? In 6.x it was.