Dynamic URL in the body of a Email connector

Good morning
i want to do this in Bonita: send an Email with a link to my ERP in its body. This is the static URL of my ERP:
http://hostname:numberport/session&programme&code
I want to retrieve the information about the code dynamically from a variable (business object defined in the business data model set in Bonita). This variable is defined as a java object as Socio#getCodice. I am trying to substitute this variable to my static ERP code at the end of my URL but it doesn’t work. I have tried to put Socio#getCodice, #getCodice, getCodice, getCodice() in the place of my code at the end of the URL but no one works.
How can i do that?
Thank you very much.
Fabio.

Hi,

Here is an example of message body definition to include value of an attribute (named: desination) of a business variable (named: travelRequest) in an URL:

Here is an email that include a dynamic link based on business variable
value: https://localhost/destination-information/${travelRequest.destination}
The dollar sign and curly brace allow to include Groovy code that will be evaluated.

If i follow your instructions:

http://hostname:numberport/session&programme&${Socio.Codice}

Bonita returns me this error while i test:

Unsupported expression type for testing:
-Input parameter ‘message’ use an expression containing unreachable reference

In my case, Socio is the business data model (business variable) and Codice its attribute (type=text).
This business variable works regularly in the workflow.

Thank you very much.

Fabio.

Is it possible for you to share your process .bos file?

Also can you let me know where did you put your connector (beginning of process, end, on a task…)? Are you sure that business variable is initialized when you try to use it?

  1. Yes, it is. How can i extract that?
  2. End of a process
  3. I am quite sure because if i use it in the body of my email with Java it appears regularly.

Let me know.

Thanks.

Fabio.

From Bonita Studio, you can click on “File” → “Export” menu. It will create a .bos file. You can then upload it on Google Drive, Dropbox… and share the link here.

Also can you add this as a comment on my answer? This will avoid to create several “answers” that don’t actually answer to your question.

I have Bonita Community, and by File–>Export i don’t have the possibility to export a .bos file.
Thanks.

In the export screen (after you clicked on File → Export), “Detination path” should be a path to a file that will be created with .bos extension. I use Bonita Studio Community Edition and I have this feature and it is available since version 6.0.0.

Ok, this is the link to view it:
https://drive.google.com/open?id=13-OheMuMLwKQknEAWXWNZ1-yF_m5zcMb
Thanks.

I set the connector out = email on the ‘Inserimento dati amministrativi’ task. I put the URL in the Message of the email: i followed your instructions but it seems not working.
Thanks.

Your business variable is named socio not Socio. Socio is the name of the business object (the type definition). If you update the script in the email connector it should work.

So, i have to put this url?
http://localhost:10000/EXTCMD&MGD020&M&${socio}
or this?
http://localhost:10000/EXTCMD&MGD020&M&${socio.Codice}
They both give me the error saw before.
Thanks.

Hi
could you please answer to my last question below?
Thank you very much.
Fabio.

You should use ${socio.Codice}

Note that in your BDM I recommend to use lower case for the first letter of the attributes. We use Java code convention (https://www.oracle.com/technetwork/java/codeconventions-135099.html): classes for BDM objects and variables for BDM attributes.

It works now.
Thank you very much.
Bye.
Fabio.