Need to display a document download url and the author as well

1
0
-1

Hi
I am using Bonita Subscription 7.1.2 .
I have a task where multiple approvers will review a task and attach a document each.
The requestor will be able to see the final status after all review is complete.
The requestor should be able to see the documents that the approvers have attached.
I was able to do that , but currently there is a list of all document url/links available.
To make more sense out of it, I need to display the approver name beside the document so that the requestor is able to identify which approver has attached which document.
As I can see , the Document_ref variable has a field called author which returns the author id .
How can we fetch the username based on the author id inside the designer page ?
Also if we need to use groovy script in the operation section to fetch the username , then what flow should we use so that we get both the document name and document author name in a process variable and show it in the requestor page alligned to the correct document download link ?

1 answer

1
0
-1

What? :)

Easier to write this down as a sequence, 1. 2. 3.

I would also be very careful about using the term Author, as there is no concept of Author in Bonitasoft. There is an Uploader (Submitter) and that would be the person doing the upload.

The SubmitterId can be used to read the organization and get the users name. This is quite easy and documented in JavaDoc and elsewhere on the forum.

As for "(how to) show it in the requester page aligned to the correct document download link ?"

Simple - Use a repeating Table. See here for example: http://documentation.bonitasoft.com/?page=repeat-a-container-for-a-colle...

regards
Seán

PS: As this reply answers your question, please mark as resolved by ticking the tick mark on the left of this reply.

Comments

Submitted by Dibyajit.Roy on Mon, 09/12/2016 - 12:39

Hi Sean

Thanks for your reply.
I am familiar with the Concept of Using a container -> setting the value as my collection -> using $item for each item from the container.
I have done the above. I get all the documents from the Document list.
But I am not sure how to fetch the username for each document .
By Using {{$item.author}} in a text field , i can fetch the submitter id . But how do I fetch the username in that text area or text field .
Alternatievely I need to add a operation in the previous task, capture both username and user id and store them in a process variable.
Now How do i match the values of the process variable and that of the $item since its a collection.

Any feedback is much appreciated.
Thanks

Submitted by Sean McP on Tue, 09/13/2016 - 12:36

Personally we do this the easy way.

We do everything beforehand (in a previous service task) and create a HTML table which has columns:

Document : Submitter : Date

and display this in a text field.

Doing this allows you also to have Document Links etc. accordingly.

We do not use the container as it doesn't always meet our need.

Note: when using HTML like this you will need to create your own Custom Widget as follows:

Template:

<div ng-bind-html="thisCanBeusedInsideNgBindHtml"></div>

Controller:

function ($scope, $sce) {
    $scope.thisCanBeusedInsideNgBindHtml = $sce.trustAsHtml($scope.properties.testHTML);
    /**$scope.thisCanBeusedInsideNgBindHtml = $sce.trustAsHtml("<i>this text will be OK</i>");
    */

}

Properties:

testHTML
Label: testHTML
Treat as Dynamic value
Type: text
Default value: No data found

The Property can be linked to a form variable that is loaded by the form.

NOTE: the use of $sce should be done with care as it bypasses all Angular's security mechanisms for injecting HTML to a form. You must be sure of the HTML code you are going generate when using it.

regards
Seán

Notifications