How to show user (First Name ,Last Name)and manager in the first form instatiation

1
0
-1

hello everybody anyone can help me
I have a question how can I show user and manager in the first form instantiation

  1. demandesCongesVar.idDemandeur = processInstance.startedBy
  2. long managerId = BonitaUsers.getProcessInstanceInitiatorManager(apiAccessor, processInstanceId).id;
  3. demandesCongesVar.setManagerID(managerId)
  4. demandesCongesVar.setFirstName(BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).firstName)
  5. demandesCongesVar.setLastName(BonitaUsers.getProcessInstanceInitiator(apiAccessor, processInstanceId).lastName)
  6.  
  7. demandesCongesVar.setManager(BonitaUsers.getProcessInstanceInitiatorManager(apiAccessor, processInstanceId).userName)

I can show manager and user in the second form of manager but in the first I can't

1 answer

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

I've included some debug boxes so you can see what's happening...

Here is the first part:

  1. Open your instantiation form
  2. Add a variable session External API = ../API/system/session/unusedId
  3. Add a variable userDetails External API = ../API/identity/user/{{session.user_id}}?d=professional_data&d=manager_id
  4. Add text box Text = Session Data:
    {{session}}
  5. Add text box Text = User Details:
    {{userDetails}}
  6. Execute the task (do not preview as it will not work (preview does not create a session only executing the process does))

And there you have it all you need to show the user name (first, last and managers name)

The second part of showing it the way you want to show it I will leave to you :)

regards
Seán

PS: As this reply answers your question, please mark as resolved.

Comments

Submitted by helaguesmi on Fri, 05/12/2017 - 13:01

@Sean MCP thank you very much for your reply . it works only manager I d'ont know how can i do manager name I do like this but not work
userDetails.manager_id.user_name??? AND i do this userDetails.managerUserName not work

Submitted by Sean McP on Fri, 05/12/2017 - 22:28

?????? Why are you talking about user_name - you wanted First Name and Last Name and Managers Name.

Very easy:

Add four text boxes to your form:

Name them: First Name, Last Name, Managers First Name, Managers Last Name

In each of the boxes: change the value to:

  • userDetails.firstname
  • userDetails.lastname
  • userDetails.manager_id.firstname
  • userDetails.manager_id.lastname

It works!

ALSO: you did not read the data very well:

userDetails.manager_id.user_name is wrong it should be userDetails.manager_id.userName

and userDetails.managerUserName is just completely wrong...where is the _id.?

Anyway - All good, now please mark as resolved as there is nothing more I can do for this issue.

regards
Seán

Submitted by helaguesmi on Sat, 05/13/2017 - 19:38

it works thank you very much I d'ont know how can I mark it as resolved in this forum

Submitted by Sean McP on Sat, 05/13/2017 - 20:58

On the left of my Answer is a tick mark, click that. You can also mark it up by clicking the button above the zero...

regards

Notifications