How can I get Manager Email Address of an Initiated user?

1
0
-1

I created a process and I want to send an email to Manager after Initiator Form is completed, how can I send an email to Manager with Email connector?

3 answers

1
+1
-1

Hi,

I want really to know how to put bdm in the body of an email connector ?

Regards

Yassine

Comments

Submitted by kanni047 on Thu, 06/23/2016 - 17:25

Hi Yassine, Even I struck at this point..could you please comment here if you are able to fix it!

Submitted by yassine.zekri1994 on Thu, 06/23/2016 - 17:40

Ok no problem

Submitted by kanni047 on Thu, 06/23/2016 - 19:41
Submitted by yassine.zekri1994 on Fri, 06/24/2016 - 11:01

I see the code there but I don't know where i can put the script.

Submitted by kanni047 on Fri, 06/24/2016 - 11:03

You have to use the script editor to build up your email body, something similar to this:

StringBuilder sb = new StringBuilder();

sb.append("

");
sb.append("<body>");
sb.append("Dear ABC,</br>");
sb.append("BDM Field 1 = " + myBDM.getField1());
sb.append("BDM Field 2 = " + myBDM.getField2());
sb.append("</body>");
sb.append("

");

return sb.toString();

Submitted by kanni047 on Fri, 06/24/2016 - 11:04

I am able to achieve it, by above method..

Submitted by kanni047 on Fri, 06/24/2016 - 11:06

Can you help me on this?

How can I get BDM Values from Initiator form to Dept Manager Form
http://community.bonitasoft.com/questions-and-answers/how-can-i-get-bdm-...

Submitted by yassine.zekri1994 on Fri, 06/24/2016 - 14:40

I'm sorry but i don't have any idea about this. if you didn't find any solution in the end . I think you should to save the BDM Values form initiator in another data base and finally get them from.

1
0
-1

I want Initiated user's Manager Email Address, I tried with below but it is not working can you please have a look at it?

${import org.ow2.bonita.facade.IdentityAPI;
import org.ow2.bonita.facade.identity.User;
IdentityAPI api = apiAccessor.getIdentityAPI();
User user = api.findUserByUserName(processInstance.getStartedBy());

long managerId = BonitaUsers.getProcessInstanceInitiatorManager(apiAccessor, processInstanceId).id;
ContactData contactData = BonitaUsers.getUserProfessionalContactInfo(apiAccessor, managerId);
return contactData.email;
}

1
0
-1

You'll have to write a small groovy script to do this :

// retrieve the initiator's manager's id
long managerId = BonitaUsers.getProcessInstanceInitiatorManager(apiAccessor, processInstanceId).id;
// get the manager's contact data
ContactData contactData = BonitaUsers.getUserProfessionalContactInfo(apiAccessor, managerId);
return contactData.email;

processInstanceId, managerId and apiAccessor are variables provided by Bonita.

Comments

Submitted by kanni047 on Fri, 06/03/2016 - 12:07

I want Initiated user's Manager Email Address, I tried with below but it is not working can you please have a look at it?

${import org.ow2.bonita.facade.IdentityAPI;
import org.ow2.bonita.facade.identity.User;
IdentityAPI api = apiAccessor.getIdentityAPI();
User user = api.findUserByUserName(processInstance.getStartedBy());

long managerId = BonitaUsers.getProcessInstanceInitiatorManager(apiAccessor, processInstanceId).id;
ContactData contactData = BonitaUsers.getUserProfessionalContactInfo(apiAccessor, managerId);
return contactData.email;
}

Submitted by Quentin Choulet on Fri, 06/03/2016 - 15:11

The first 4 lines are not needed. Is it the whole script or just a part of it ? If this is the whole script it shouldn't be wrapped in ${ }. I assumed you are familiar with programming languages. If you're not let me know an I'll provide more explanations.

Notifications